htlcswitch: update link to match latest ChanSyncMsg API change

This commit is contained in:
Olaoluwa Osuntokun 2017-11-13 22:51:16 -08:00
parent 88d418c0ec
commit 6afebfba5d
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
2 changed files with 14 additions and 3 deletions

@ -317,7 +317,12 @@ func (l *channelLink) htlcManager() {
// First, we'll generate our ChanSync message to send to the // First, we'll generate our ChanSync message to send to the
// other side. Based on this message, the remote party will // other side. Based on this message, the remote party will
// decide if they need to retransmit any data or not. // decide if they need to retransmit any data or not.
localChanSyncMsg := l.channel.ChanSyncMsg() localChanSyncMsg, err := l.channel.ChanSyncMsg()
if err != nil {
l.fail("unable to generate chan sync message for "+
"ChannelPoint(%v)", l.channel.ChannelPoint())
return
}
if err := l.cfg.Peer.SendMessage(localChanSyncMsg); err != nil { if err := l.cfg.Peer.SendMessage(localChanSyncMsg); err != nil {
l.fail("Unable to send chan sync message for "+ l.fail("Unable to send chan sync message for "+
"ChannelPoint(%v)", l.channel.ChannelPoint()) "ChannelPoint(%v)", l.channel.ChannelPoint())
@ -706,6 +711,8 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
// need to re-transmit any messages to the remote party. // need to re-transmit any messages to the remote party.
msgsToReSend, err := l.channel.ProcessChanSyncMsg(msg) msgsToReSend, err := l.channel.ProcessChanSyncMsg(msg)
if err != nil { if err != nil {
// TODO(roasbeef): check conrete type of error, act
// accordingly
l.fail("unable to handle upstream reestablish "+ l.fail("unable to handle upstream reestablish "+
"message: %v", err) "message: %v", err)
return return

@ -358,16 +358,20 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
} }
} }
// TODO(roasbeef): should instead consume async notifications from both
// links
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
// At the end Bob and Alice balances should be the same as previous, // At the end Bob and Alice balances should be the same as previous,
// because they sent the equal amount of money to each other. // because they sent the equal amount of money to each other.
if aliceBandwidthBefore != n.aliceChannelLink.Bandwidth() { if aliceBandwidthBefore != n.aliceChannelLink.Bandwidth() {
t.Fatal("alice bandwidth shouldn't have changed") t.Fatalf("alice bandwidth shouldn't have changed: expected %v, got %x",
aliceBandwidthBefore, n.aliceChannelLink.Bandwidth())
} }
if bobBandwidthBefore != n.firstBobChannelLink.Bandwidth() { if bobBandwidthBefore != n.firstBobChannelLink.Bandwidth() {
t.Fatal("bob bandwidth shouldn't have changed") t.Fatalf("bob bandwidth shouldn't have changed: expected %v, got %v",
bobBandwidthBefore, n.firstBobChannelLink.Bandwidth())
} }
t.Logf("Max waiting: %v", maxDelay) t.Logf("Max waiting: %v", maxDelay)