diff --git a/aliasmgr/aliasmgr.go b/aliasmgr/aliasmgr.go index 381476a738..f33eb391eb 100644 --- a/aliasmgr/aliasmgr.go +++ b/aliasmgr/aliasmgr.go @@ -38,7 +38,7 @@ var ( lastAliasKey = []byte("last-alias-key") // invoiceAliasBucket is a root-level bucket that stores the alias - // SCIDs that our peers send us in the funding_locked TLV. The keys are + // SCIDs that our peers send us in the channel_ready TLV. The keys are // the ChannelID generated from the FundingOutpoint and the values are // the remote peer's alias SCID. invoiceAliasBucket = []byte("invoice-alias-bucket") @@ -88,7 +88,7 @@ type Manager struct { aliasToBase map[lnwire.ShortChannelID]lnwire.ShortChannelID // peerAlias is a cache for the alias SCIDs that our peers send us in - // the funding_locked TLV. The keys are the ChannelID generated from + // the channel_ready TLV. The keys are the ChannelID generated from // the FundingOutpoint and the values are the remote peer's alias SCID. // The values should match the ones stored in the "invoice-alias-bucket" // bucket. @@ -341,7 +341,7 @@ func (m *Manager) DeleteSixConfs(baseScid lnwire.ShortChannelID) error { } // PutPeerAlias stores the peer's alias SCID once we learn of it in the -// funding_locked message. +// channel_ready message. func (m *Manager) PutPeerAlias(chanID lnwire.ChannelID, alias lnwire.ShortChannelID) error { diff --git a/channeldb/channel.go b/channeldb/channel.go index d71f17047d..ed09605ef8 100644 --- a/channeldb/channel.go +++ b/channeldb/channel.go @@ -1345,7 +1345,7 @@ func (c *OpenChannel) MarkBorked() error { } // SecondCommitmentPoint returns the second per-commitment-point for use in the -// funding_locked message. +// channel_ready message. func (c *OpenChannel) SecondCommitmentPoint() (*btcec.PublicKey, error) { c.RLock() defer c.RUnlock() diff --git a/funding/interfaces.go b/funding/interfaces.go index 09270d1496..b87705424b 100644 --- a/funding/interfaces.go +++ b/funding/interfaces.go @@ -23,15 +23,15 @@ type Controller interface { // aliasHandler is an interface that abstracts the managing of aliases. type aliasHandler interface { // RequestAlias lets the funding manager request a unique SCID alias to - // use in the funding_locked message. + // use in the channel_ready message. RequestAlias() (lnwire.ShortChannelID, error) // PutPeerAlias lets the funding manager store the received alias SCID - // in the funding_locked message. + // in the channel_ready message. PutPeerAlias(lnwire.ChannelID, lnwire.ShortChannelID) error // GetPeerAlias lets the funding manager lookup the received alias SCID - // from the funding_locked message. This is not the same as GetAliases + // from the channel_ready message. This is not the same as GetAliases // which retrieves OUR aliases for a given channel. GetPeerAlias(lnwire.ChannelID) (lnwire.ShortChannelID, error) diff --git a/funding/manager.go b/funding/manager.go index 9190a27781..7faeb098c1 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -1022,7 +1022,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel, } log.Debugf("Channel(%v) with ShortChanID %v: successfully "+ - "sent FundingLocked", chanID, shortChanID) + "sent ChannelReady", chanID, shortChanID) return nil @@ -1054,7 +1054,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel, var peerAlias *lnwire.ShortChannelID if channel.IsZeroConf() { - // We'll need to wait until funding_locked has been + // We'll need to wait until channel_ready has been // received and the peer lets us know the alias they // want to use for the channel. With this information, // we can then construct a ChannelUpdate for them. @@ -2963,7 +2963,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel, // alias feature was negotiated, check if we already // have an alias stored in case handleFundingLocked was // called before this. If an alias exists, use that in - // funding_locked. Otherwise, request and store an + // channel_ready. Otherwise, request and store an // alias and use that. aliases := f.cfg.AliasManager.GetAliases( completeChan.ShortChannelID, @@ -2989,7 +2989,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel, } } - log.Infof("Peer(%x) is online, sending FundingLocked "+ + log.Infof("Peer(%x) is online, sending ChannelReady "+ "for ChannelID(%v)", peerKey, chanID) if err := peer.SendMessage(true, channelReadyMsg); err == nil { @@ -3028,7 +3028,7 @@ func (f *Manager) receivedChannelReady(node *btcec.PublicKey, channel, err := f.cfg.FindChannel(node, chanID) if err != nil { log.Errorf("Unable to locate ChannelID(%v) to determine if "+ - "FundingLocked was received", chanID) + "ChannelReady was received", chanID) return false, err } @@ -3397,7 +3397,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, msg *lnwire.ChannelReady) { defer f.wg.Done() - log.Debugf("Received FundingLocked for ChannelID(%v) from "+ + log.Debugf("Received ChannelReady for ChannelID(%v) from "+ "peer %x", msg.ChanID, peer.IdentityKey().SerializeCompressed()) @@ -3487,14 +3487,14 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, // If we do not have an alias stored, we'll create one now. // This is only used in the upgrade case where a user toggles // the option-scid-alias feature-bit to on. We'll also send the - // funding_locked message here in case the link is created + // channel_ready message here in case the link is created // before sendFundingLocked is called. aliases := f.cfg.AliasManager.GetAliases( channel.ShortChannelID, ) if len(aliases) == 0 { // No aliases were found so we'll request and store an - // alias and use it in the funding_locked message. + // alias and use it in the channel_ready message. alias, err := f.cfg.AliasManager.RequestAlias() if err != nil { log.Errorf("unable to request alias: %v", err) @@ -3535,7 +3535,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, // already processed fundingLocked for this channel, so ignore. This // check is after the alias logic so we store the peer's most recent // alias. The spec requires us to validate that subsequent - // funding_locked messages use the same per commitment point (the + // channel_ready messages use the same per commitment point (the // second), but it is not actually necessary since we'll just end up // ignoring it. We are, however, required to *send* the same per // commitment point, since another pedantic implementation might diff --git a/funding/manager_test.go b/funding/manager_test.go index 967669a220..fe358e6730 100644 --- a/funding/manager_test.go +++ b/funding/manager_test.go @@ -900,7 +900,7 @@ func assertFundingMsgSent(t *testing.T, msgChan chan lnwire.Message, sentMsg, ok = msg.(*lnwire.FundingCreated) case "FundingSigned": sentMsg, ok = msg.(*lnwire.FundingSigned) - case "FundingLocked": + case "ChannelReady": sentMsg, ok = msg.(*lnwire.ChannelReady) case "Error": sentMsg, ok = msg.(*lnwire.Error) @@ -1407,12 +1407,12 @@ func TestFundingManagerNormalWorkflow(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Check that the state machine is updated accordingly @@ -1678,7 +1678,7 @@ func TestFundingManagerRestartBehavior(t *testing.T) { // Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Alice should still be markedOpen @@ -1707,7 +1707,7 @@ func TestFundingManagerRestartBehavior(t *testing.T) { } channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // The state should now be fundingLockedSent @@ -1835,7 +1835,7 @@ func TestFundingManagerOfflinePeer(t *testing.T) { // Bob will send funding locked to Alice channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Alice should still be markedOpen @@ -1883,7 +1883,7 @@ func TestFundingManagerOfflinePeer(t *testing.T) { // This should make Alice send the fundingLocked. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // The state should now be fundingLockedSent @@ -2312,12 +2312,12 @@ func TestFundingManagerReceiveChannelReadyTwice(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Check that the state machine is updated accordingly @@ -2423,12 +2423,12 @@ func TestFundingManagerRestartAfterChanAnn(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Check that the state machine is updated accordingly @@ -2520,12 +2520,12 @@ func TestFundingManagerRestartAfterReceivingChannelReady(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Check that the state machine is updated accordingly @@ -2613,12 +2613,12 @@ func TestFundingManagerPrivateChannel(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Check that the state machine is updated accordingly @@ -2736,12 +2736,12 @@ func TestFundingManagerPrivateRestart(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Check that the state machine is updated accordingly @@ -3171,12 +3171,12 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) { // After the funding transaction is mined, Alice will send // fundingLocked to Bob. channelReadyAlice := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // And similarly Bob will send funding locked to Alice. channelReadyBob := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) // Exchange the fundingLocked messages. @@ -3488,11 +3488,11 @@ func TestFundingManagerMaxPendingChannels(t *testing.T) { // Expect both to be sending FundingLocked. _ = assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) _ = assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) } @@ -4202,21 +4202,21 @@ func TestFundingManagerZeroConf(t *testing.T) { Index: 0, } - // Assert that Bob's funding_locked message has an AliasScid. + // Assert that Bob's channel_ready message has an AliasScid. bobChannelReady := assertFundingMsgSent( - t, bob.msgChan, "FundingLocked", + t, bob.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) require.NotNil(t, bobChannelReady.AliasScid) require.Equal(t, *bobChannelReady.AliasScid, alias) // Do the same for Alice as well. aliceChannelReady := assertFundingMsgSent( - t, alice.msgChan, "FundingLocked", + t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) require.NotNil(t, aliceChannelReady.AliasScid) require.Equal(t, *aliceChannelReady.AliasScid, alias) - // Exchange the funding_locked messages. + // Exchange the channel_ready messages. alice.fundingMgr.ProcessFundingMsg(bobChannelReady, bob) bob.fundingMgr.ProcessFundingMsg(aliceChannelReady, alice) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 1151286eeb..20aa90bb70 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -726,7 +726,7 @@ func (l *channelLink) syncChanStates() error { 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 { @@ -740,7 +740,7 @@ func (l *channelLink) syncChanStates() error { // 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. @@ -762,7 +762,7 @@ func (l *channelLink) syncChanStates() error { err = l.cfg.Peer.SendMessage(false, channelReadyMsg) if err != nil { return fmt.Errorf("unable to re-send "+ - "FundingLocked: %v", err) + "ChannelReady: %v", err) } } diff --git a/lnwire/features.go b/lnwire/features.go index c386fd37be..76dab3b051 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -169,12 +169,12 @@ const ( // ScidAliasRequired is a required feature bit that signals that the // node requires understanding of ShortChannelID aliases in the TLV - // segment of the funding_locked message. + // segment of the channel_ready message. ScidAliasRequired FeatureBit = 46 // ScidAliasOptional is an optional feature bit that signals that the // node understands ShortChannelID aliases in the TLV segment of the - // funding_locked message. + // channel_ready message. ScidAliasOptional FeatureBit = 47 // PaymentMetadataRequired is a required bit that denotes that if an diff --git a/lnwire/message.go b/lnwire/message.go index ad065bb460..02447b806c 100644 --- a/lnwire/message.go +++ b/lnwire/message.go @@ -89,7 +89,7 @@ func (t MessageType) String() string { case MsgFundingSigned: return "MsgFundingSigned" case MsgChannelReady: - return "FundingLocked" + return "ChannelReady" case MsgShutdown: return "Shutdown" case MsgClosingSigned: diff --git a/peer/brontide.go b/peer/brontide.go index 7e838a62cd..063e82c567 100644 --- a/peer/brontide.go +++ b/peer/brontide.go @@ -717,11 +717,11 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) ( // manager are not aware of each other's states and if // we did not do this, we would accept alias channel // updates after 6 confirmations, which would be buggy. - // We'll queue a funding_locked message with the new + // We'll queue a channel_ready message with the new // alias. This should technically be done *after* the // reestablish, but this behavior is pre-existing since // the funding manager may already queue a - // funding_locked before the channel_reestablish. + // channel_ready before the channel_reestablish. if !dbChan.IsPending { aliasScid, err := p.cfg.RequestAlias() if err != nil { @@ -740,7 +740,7 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) ( ) // Fetch the second commitment point to send in - // the funding_locked message. + // the channel_ready message. second, err := dbChan.SecondCommitmentPoint() if err != nil { return nil, err @@ -2372,7 +2372,7 @@ out: } p.log.Infof("Processing retransmitted "+ - "FundingLocked for ChannelPoint(%v)", + "ChannelReady for ChannelPoint(%v)", chanPoint) nextRevoke := newChan.RemoteNextRevocation