diff --git a/channeldb/channel.go b/channeldb/channel.go index ed09605ef..b731028ee 100644 --- a/channeldb/channel.go +++ b/channeldb/channel.go @@ -3770,7 +3770,7 @@ func putChanRevocationState(chanBucket kvdb.RwBucket, channel *OpenChannel) erro // TODO(roasbeef): don't keep producer on disk // If the next revocation is present, which is only the case after the - // FundingLocked message has been sent, then we'll write it to disk. + // ChannelReady message has been sent, then we'll write it to disk. if channel.RemoteNextRevocation != nil { err = WriteElements(&b, channel.RemoteNextRevocation) if err != nil { diff --git a/funding/manager.go b/funding/manager.go index 7faeb098c..c43b99830 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -40,8 +40,8 @@ var ( // buffers. byteOrder = binary.BigEndian - // checkPeerFundingLockInterval is used when we are waiting for the - // peer to send us FundingLocked. We will check every 1 second to see + // checkPeerChannelReadyInterval is used when we are waiting for the + // peer to send us ChannelReady. We will check every 1 second to see // if the message is received. // // NOTE: for itest, this value is changed to 10ms. @@ -1040,9 +1040,9 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel, } if !received { - // We haven't received FundingLocked, so we'll continue + // We haven't received ChannelReady, so we'll continue // to the next iteration of the loop after sleeping for - // checkPeerFundingLockInterval. + // checkPeerChannelReadyInterval. select { case <-time.After(checkPeerChannelReadyInterval): case <-f.quit: @@ -1213,7 +1213,7 @@ func (f *Manager) advancePendingChannelState( f.cfg.NotifyOpenChannelEvent(channel.FundingOutpoint) // Find and close the discoverySignal for this channel such - // that FundingLocked messages will be processed. + // that ChannelReady messages will be processed. chanID := lnwire.NewChanIDFromOutPoint( &channel.FundingOutpoint, ) @@ -2890,7 +2890,7 @@ func (f *Manager) handleFundingConfirmation( return nil } -// sendFundingLocked creates and sends the fundingLocked message. +// sendChannelReady creates and sends the fundingLocked message. // This should be called after the funding transaction has been confirmed, // and the channelState is 'markedOpen'. func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel, @@ -2961,7 +2961,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel, // If an alias was not assigned above and the scid // alias feature was negotiated, check if we already - // have an alias stored in case handleFundingLocked was + // have an alias stored in case handleChannelReady was // called before this. If an alias exists, use that in // channel_ready. Otherwise, request and store an // alias and use that. @@ -3005,7 +3005,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel, return nil } -// receivedFundingLocked checks whether or not we've received a FundingLocked +// receivedChannelReady checks whether or not we've received a ChannelReady // from the remote peer. If we have, RemoteNextRevocation will be set. func (f *Manager) receivedChannelReady(node *btcec.PublicKey, chanID lnwire.ChannelID) (bool, error) { @@ -3391,7 +3391,7 @@ func (f *Manager) waitForZeroConfChannel(c *channeldb.OpenChannel, return nil } -// handleFundingLocked finalizes the channel funding process and enables the +// handleChannelReady finalizes the channel funding process and enables the // channel to enter normal operating mode. func (f *Manager) handleChannelReady(peer lnpeer.Peer, msg *lnwire.ChannelReady) { @@ -3464,7 +3464,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, // during invoice creation. In the zero-conf case, it is also used to // provide a ChannelUpdate to the remote peer. This is done before the // call to InsertNextRevocation in case the call to PutPeerAlias fails. - // If it were to fail on the first call to handleFundingLocked, we + // If it were to fail on the first call to handleChannelReady, we // wouldn't want the channel to be usable yet. if channel.NegotiatedAliasFeature() { // If the AliasScid field is nil, we must fail out. We will @@ -3488,7 +3488,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, // 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 // channel_ready message here in case the link is created - // before sendFundingLocked is called. + // before sendChannelReady is called. aliases := f.cfg.AliasManager.GetAliases( channel.ShortChannelID, ) diff --git a/funding/manager_test.go b/funding/manager_test.go index fe358e673..8779dd7b4 100644 --- a/funding/manager_test.go +++ b/funding/manager_test.go @@ -1082,7 +1082,7 @@ func assertChannelAnnouncements(t *testing.T, alice, bob *testNode, t.Helper() - // After the FundingLocked message is sent, Alice and Bob will each send + // After the ChannelReady message is sent, Alice and Bob will each send // the following messages to their gossiper: // 1) ChannelAnnouncement // 2) ChannelUpdate @@ -1222,7 +1222,7 @@ func assertChannelAnnouncements(t *testing.T, alice, bob *testNode, func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) { t.Helper() - // After the FundingLocked message is sent and six confirmations have + // After the ChannelReady message is sent and six confirmations have // been reached, the channel will be announced to the greater network // by having the nodes exchange announcement signatures. // Two distinct messages will be sent: @@ -1868,7 +1868,7 @@ func TestFundingManagerOfflinePeer(t *testing.T) { } // Before sending on the con chan, update Alice's NotifyWhenOnline - // function so that the next invocation in receivedFundingLocked will + // function so that the next invocation in receivedChannelReady will // use this new function. alice.fundingMgr.cfg.NotifyWhenOnline = func(peer [33]byte, connected chan<- lnpeer.Peer) { @@ -2272,7 +2272,7 @@ func TestFundingManagerFundingNotTimeoutInitiator(t *testing.T) { assertNumPendingChannelsBecomes(t, bob, 0) } -// TestFundingManagerReceiveFundingLockedTwice checks that the fundingManager +// TestFundingManagerReceiveChannelReadyTwice checks that the fundingManager // continues to operate as expected in case we receive a duplicate fundingLocked // message. func TestFundingManagerReceiveChannelReadyTwice(t *testing.T) { @@ -2480,7 +2480,7 @@ func TestFundingManagerRestartAfterChanAnn(t *testing.T) { assertNoFwdingPolicy(t, alice, bob, fundingOutPoint) } -// TestFundingManagerRestartAfterReceivingFundingLocked checks that the +// TestFundingManagerRestartAfterReceivingChannelReady checks that the // fundingManager continues to operate as expected after it has received // fundingLocked and then gets restarted. func TestFundingManagerRestartAfterReceivingChannelReady(t *testing.T) { @@ -3486,7 +3486,7 @@ func TestFundingManagerMaxPendingChannels(t *testing.T) { Tx: txs[i], } - // Expect both to be sending FundingLocked. + // Expect both to be sending ChannelReady. _ = assertFundingMsgSent( t, alice.msgChan, "ChannelReady", ).(*lnwire.ChannelReady) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 20aa90bb7..2b158d7dc 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -721,7 +721,7 @@ 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() { diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index b1e134954..099fdb8f6 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -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() diff --git a/lntest/README.md b/lntest/README.md index be28b218f..5752031ec 100644 --- a/lntest/README.md +++ b/lntest/README.md @@ -101,8 +101,8 @@ the real-world has. Aside from that, `lnd` has several places that use different code, which is triggered by the build flag `integration`, to speed up the tests. They are summarized as followings, -1. `funding.checkPeerFundingLockInterval`, which is used when we wait for the - peer to send us `FundingLocked`. This value is 1 second in `lnd`, and 10 +1. `funding.checkPeerChannelReadyInterval`, which is used when we wait for the + peer to send us `ChannelReady`. This value is 1 second in `lnd`, and 10 milliseconds in `lntest`. 2. `lncfg.ProtocolOptions`, which is used to specify protocol flags. In `lnd`, anchor and script enforced lease are enabled by default, while in `lntest`, diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 97b7ac44d..d715d5ed6 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -4063,7 +4063,7 @@ func (lc *LightningChannel) ProcessChanSyncMsg( // If we get a failure due to not knowing their next // point, then this is fine as they'll either send - // FundingLocked, or revoke their next state to allow + // ChannelReady, or revoke their next state to allow // us to continue forwards. case err == ErrNoWindow: @@ -7220,7 +7220,7 @@ func (lc *LightningChannel) generateRevocation(height uint64) (*lnwire.RevokeAnd // Along with this revocation, we'll also send the _next_ commitment // point that the remote party should use to create our next commitment // transaction. We use a +2 here as we already gave them a look ahead - // of size one after the FundingLocked message was sent: + // of size one after the ChannelReady message was sent: // // 0: current revocation, 1: their "next" revocation, 2: this revocation // diff --git a/lnwire/funding_locked.go b/lnwire/funding_locked.go index 0995f91d3..9027997de 100644 --- a/lnwire/funding_locked.go +++ b/lnwire/funding_locked.go @@ -8,9 +8,9 @@ import ( "github.com/lightningnetwork/lnd/tlv" ) -// FundingLocked is the message that both parties to a new channel creation +// ChannelReady is the message that both parties to a new channel creation // send once they have observed the funding transaction being confirmed on the -// blockchain. FundingLocked contains the signatures necessary for the channel +// blockchain. ChannelReady contains the signatures necessary for the channel // participants to advertise the existence of the channel to the rest of the // network. type ChannelReady struct { @@ -33,7 +33,7 @@ type ChannelReady struct { ExtraData ExtraOpaqueData } -// NewFundingLocked creates a new FundingLocked message, populating it with the +// NewChannelReady creates a new ChannelReady message, populating it with the // necessary IDs and revocation secret. func NewChannelReady(cid ChannelID, npcp *btcec.PublicKey) *ChannelReady { return &ChannelReady{ @@ -43,12 +43,12 @@ func NewChannelReady(cid ChannelID, npcp *btcec.PublicKey) *ChannelReady { } } -// A compile time check to ensure FundingLocked implements the lnwire.Message +// A compile time check to ensure ChannelReady implements the lnwire.Message // interface. var _ Message = (*ChannelReady)(nil) -// Decode deserializes the serialized FundingLocked message stored in the -// passed io.Reader into the target FundingLocked using the deserialization +// Decode deserializes the serialized ChannelReady message stored in the +// passed io.Reader into the target ChannelReady using the deserialization // rules defined by the passed protocol version. // // This is part of the lnwire.Message interface. @@ -80,7 +80,7 @@ func (c *ChannelReady) Decode(r io.Reader, pver uint32) error { return nil } -// Encode serializes the target FundingLocked message into the passed io.Writer +// Encode serializes the target ChannelReady message into the passed io.Writer // implementation. Serialization will observe the rules defined by the passed // protocol version. // @@ -107,7 +107,7 @@ func (c *ChannelReady) Encode(w *bytes.Buffer, pver uint32) error { } // MsgType returns the uint32 code which uniquely identifies this message as a -// FundingLocked message on the wire. +// ChannelReady message on the wire. // // This is part of the lnwire.Message interface. func (c *ChannelReady) MsgType() MessageType { diff --git a/lnwire/fuzz_test.go b/lnwire/fuzz_test.go index 7e3823773..f578663a3 100644 --- a/lnwire/fuzz_test.go +++ b/lnwire/fuzz_test.go @@ -288,7 +288,7 @@ func FuzzFundingCreated(f *testing.F) { func FuzzChannelReady(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { - // Prefix with MsgFundingLocked. + // Prefix with MsgChannelReady. data = prefixWithMsgType(data, MsgChannelReady) // Pass the message into our general fuzz harness for wire diff --git a/netann/chan_status_manager.go b/netann/chan_status_manager.go index 8f29888e5..8340c202c 100644 --- a/netann/chan_status_manager.go +++ b/netann/chan_status_manager.go @@ -54,7 +54,7 @@ type ChanStatusConfig struct { // IsChannelActive checks whether the channel identified by the provided // ChannelID is considered active. This should only return true if the // channel has been sufficiently confirmed, the channel has received - // FundingLocked, and the remote peer is online. + // ChannelReady, and the remote peer is online. IsChannelActive func(lnwire.ChannelID) bool // ApplyChannelUpdate processes new ChannelUpdates signed by our node by