Merge pull request #7517 from yyforyongyu/fix-funding-locked
Replace `FundingLocked` with `ChannelReady`
This commit is contained in:
22 files changed
+364
-324
No files matched your search
+7
-7
@@ -724,12 +724,12 @@ func (l *channelLink) syncChanStates() error {
|
||||
// done any state updates yet, then we'll retransmit the
|
||||
// funding locked message first. We do this, as at this point
|
||||
// we can't be sure if they've really received the
|
||||
// FundingLocked message.
|
||||
// ChannelReady message.
|
||||
if remoteChanSyncMsg.NextLocalCommitHeight == 1 &&
|
||||
localChanSyncMsg.NextLocalCommitHeight == 1 &&
|
||||
!l.channel.IsPending() {
|
||||
|
||||
l.log.Infof("resending FundingLocked message to peer")
|
||||
l.log.Infof("resending ChannelReady message to peer")
|
||||
|
||||
nextRevocation, err := l.channel.NextRevocationKey()
|
||||
if err != nil {
|
||||
@@ -737,13 +737,13 @@ func (l *channelLink) syncChanStates() error {
|
||||
"revocation: %v", err)
|
||||
}
|
||||
|
||||
fundingLockedMsg := lnwire.NewFundingLocked(
|
||||
channelReadyMsg := lnwire.NewChannelReady(
|
||||
l.ChanID(), nextRevocation,
|
||||
)
|
||||
|
||||
// For channels that negotiated the option-scid-alias
|
||||
// feature bit, ensure that we send over the alias in
|
||||
// the funding_locked message. We'll send the first
|
||||
// the channel_ready message. We'll send the first
|
||||
// alias we find for the channel since it does not
|
||||
// matter which alias we send. We'll error out if no
|
||||
// aliases are found.
|
||||
@@ -759,13 +759,13 @@ func (l *channelLink) syncChanStates() error {
|
||||
// getAliases returns a copy of the alias slice
|
||||
// so it is ok to use a pointer to the first
|
||||
// entry.
|
||||
fundingLockedMsg.AliasScid = &aliases[0]
|
||||
channelReadyMsg.AliasScid = &aliases[0]
|
||||
}
|
||||
|
||||
err = l.cfg.Peer.SendMessage(false, fundingLockedMsg)
|
||||
err = l.cfg.Peer.SendMessage(false, channelReadyMsg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to re-send "+
|
||||
"FundingLocked: %v", err)
|
||||
"ChannelReady: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -1684,8 +1684,8 @@ func TestChannelLinkSingleHopMessageOrdering(t *testing.T) {
|
||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
||||
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.UpdateAddHTLC{}, false},
|
||||
{"alice", "bob", &lnwire.CommitSig{}, false},
|
||||
@@ -3303,8 +3303,8 @@ func TestChannelRetransmission(t *testing.T) {
|
||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
||||
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||
|
||||
// Send payment from Alice to Bob and intercept
|
||||
// the last revocation message, in this case
|
||||
@@ -3343,8 +3343,8 @@ func TestChannelRetransmission(t *testing.T) {
|
||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
||||
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||
|
||||
// Send payment from Alice to Bob and intercept
|
||||
// the last revocation message, in this case
|
||||
@@ -3385,8 +3385,8 @@ func TestChannelRetransmission(t *testing.T) {
|
||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
||||
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||
|
||||
// Attempt make a payment from Alice to Bob,
|
||||
// which is intercepted, emulating the Bob
|
||||
@@ -3399,8 +3399,8 @@ func TestChannelRetransmission(t *testing.T) {
|
||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
||||
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||
|
||||
// After Bob has notified Alice that he didn't
|
||||
// receive updates Alice should re-send them.
|
||||
@@ -3816,8 +3816,8 @@ func TestChannelLinkUpdateCommitFee(t *testing.T) {
|
||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||
|
||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
||||
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||
|
||||
// First fee update.
|
||||
{"alice", "bob", &lnwire.UpdateFee{}, false},
|
||||
|
||||
+1
-1
@@ -627,7 +627,7 @@ func (s *mockServer) readHandler(message lnwire.Message) error {
|
||||
targetChan = msg.ChanID
|
||||
case *lnwire.CommitSig:
|
||||
targetChan = msg.ChanID
|
||||
case *lnwire.FundingLocked:
|
||||
case *lnwire.ChannelReady:
|
||||
// Ignore
|
||||
return nil
|
||||
case *lnwire.ChannelReestablish:
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestSwitchAddDuplicateLink(t *testing.T) {
|
||||
// TestSwitchHasActiveLink tests the behavior of HasActiveLink, and asserts that
|
||||
// it only returns true if a link's short channel id has confirmed (meaning the
|
||||
// channel is no longer pending) and it's EligibleToForward method returns true,
|
||||
// i.e. it has received FundingLocked from the remote peer.
|
||||
// i.e. it has received ChannelReady from the remote peer.
|
||||
func TestSwitchHasActiveLink(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ func getChanID(msg lnwire.Message) (lnwire.ChannelID, error) {
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.ChannelReestablish:
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.FundingLocked:
|
||||
case *lnwire.ChannelReady:
|
||||
chanID = msg.ChanID
|
||||
case *lnwire.UpdateFee:
|
||||
chanID = msg.ChanID
|
||||
|
||||
Reference in new issue
Block a user