mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
multi: update "funding locked" comments
Replace a few un-caught instances of "funding locked" in some comments with "channel_ready"
This commit is contained in:
parent
7854b73892
commit
9ea3f55694
6 changed files with 27 additions and 27 deletions
|
@ -3532,7 +3532,7 @@ func deserializeCloseChannelSummary(r io.Reader) (*ChannelCloseSummary, error) {
|
||||||
|
|
||||||
// Finally, we'll attempt to read the next unrevoked commitment point
|
// Finally, we'll attempt to read the next unrevoked commitment point
|
||||||
// for the remote party. If we closed the channel before receiving a
|
// for the remote party. If we closed the channel before receiving a
|
||||||
// funding locked message then this might not be present. A boolean
|
// channel_ready message then this might not be present. A boolean
|
||||||
// indicating whether the field is present will come first.
|
// indicating whether the field is present will come first.
|
||||||
var hasRemoteNextRevocation bool
|
var hasRemoteNextRevocation bool
|
||||||
err = ReadElements(r, &hasRemoteNextRevocation)
|
err = ReadElements(r, &hasRemoteNextRevocation)
|
||||||
|
|
|
@ -40,7 +40,7 @@ func deserializeCloseChannelSummaryV6(r io.Reader) (*ChannelCloseSummary, error)
|
||||||
|
|
||||||
// Finally, we'll attempt to read the next unrevoked commitment point
|
// Finally, we'll attempt to read the next unrevoked commitment point
|
||||||
// for the remote party. If we closed the channel before receiving a
|
// for the remote party. If we closed the channel before receiving a
|
||||||
// funding locked message, then this can be nil. As a result, we'll use
|
// channel_ready message, then this can be nil. As a result, we'll use
|
||||||
// the same technique to read the field, only if there's still data
|
// the same technique to read the field, only if there's still data
|
||||||
// left in the buffer.
|
// left in the buffer.
|
||||||
err = ReadElements(r, &c.RemoteNextRevocation)
|
err = ReadElements(r, &c.RemoteNextRevocation)
|
||||||
|
|
|
@ -942,7 +942,7 @@ func (f *Manager) reservationCoordinator() {
|
||||||
// advanceFundingState will advance the channel through the steps after the
|
// advanceFundingState will advance the channel through the steps after the
|
||||||
// funding transaction is broadcasted, up until the point where the channel is
|
// funding transaction is broadcasted, up until the point where the channel is
|
||||||
// ready for operation. This includes waiting for the funding transaction to
|
// ready for operation. This includes waiting for the funding transaction to
|
||||||
// confirm, sending funding locked to the peer, adding the channel to the
|
// confirm, sending channel_ready to the peer, adding the channel to the
|
||||||
// router graph, and announcing the channel. The updateChan can be set non-nil
|
// router graph, and announcing the channel. The updateChan can be set non-nil
|
||||||
// to get OpenStatusUpdates.
|
// to get OpenStatusUpdates.
|
||||||
//
|
//
|
||||||
|
@ -1057,7 +1057,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
||||||
// channelReady was sent to peer, but the channel was not added to the
|
// channelReady was sent to peer, but the channel was not added to the
|
||||||
// router graph and the channel announcement was not sent.
|
// router graph and the channel announcement was not sent.
|
||||||
case channelReadySent:
|
case channelReadySent:
|
||||||
// We must wait until we've received the peer's funding locked
|
// We must wait until we've received the peer's channel_ready
|
||||||
// before sending a channel_update according to BOLT#07.
|
// before sending a channel_update according to BOLT#07.
|
||||||
received, err := f.receivedChannelReady(
|
received, err := f.receivedChannelReady(
|
||||||
channel.IdentityPub, chanID,
|
channel.IdentityPub, chanID,
|
||||||
|
@ -1126,7 +1126,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
||||||
|
|
||||||
// Give the caller a final update notifying them that
|
// Give the caller a final update notifying them that
|
||||||
// the channel is now open.
|
// the channel is now open.
|
||||||
// TODO(roasbeef): only notify after recv of funding locked?
|
// TODO(roasbeef): only notify after recv of channel_ready?
|
||||||
fundingPoint := channel.FundingOutpoint
|
fundingPoint := channel.FundingOutpoint
|
||||||
cp := &lnrpc.ChannelPoint{
|
cp := &lnrpc.ChannelPoint{
|
||||||
FundingTxid: &lnrpc.ChannelPoint_FundingTxidBytes{
|
FundingTxid: &lnrpc.ChannelPoint_FundingTxidBytes{
|
||||||
|
@ -2322,8 +2322,8 @@ func (f *Manager) handleFundingCreated(peer lnpeer.Peer,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an entry in the local discovery map so we can ensure that we
|
// Create an entry in the local discovery map so we can ensure that we
|
||||||
// process the channel confirmation fully before we receive a funding
|
// process the channel confirmation fully before we receive a
|
||||||
// locked message.
|
// channel_ready message.
|
||||||
f.localDiscoveryMtx.Lock()
|
f.localDiscoveryMtx.Lock()
|
||||||
f.localDiscoverySignals[channelID] = make(chan struct{})
|
f.localDiscoverySignals[channelID] = make(chan struct{})
|
||||||
f.localDiscoveryMtx.Unlock()
|
f.localDiscoveryMtx.Unlock()
|
||||||
|
@ -2386,8 +2386,8 @@ func (f *Manager) handleFundingSigned(peer lnpeer.Peer,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an entry in the local discovery map so we can ensure that we
|
// Create an entry in the local discovery map so we can ensure that we
|
||||||
// process the channel confirmation fully before we receive a funding
|
// process the channel confirmation fully before we receive a
|
||||||
// locked message.
|
// channel_ready message.
|
||||||
fundingPoint := resCtx.reservation.FundingOutpoint()
|
fundingPoint := resCtx.reservation.FundingOutpoint()
|
||||||
permChanID := lnwire.NewChanIDFromOutPoint(fundingPoint)
|
permChanID := lnwire.NewChanIDFromOutPoint(fundingPoint)
|
||||||
f.localDiscoveryMtx.Lock()
|
f.localDiscoveryMtx.Lock()
|
||||||
|
@ -2907,7 +2907,7 @@ func (f *Manager) handleFundingConfirmation(
|
||||||
|
|
||||||
// Close the discoverySignal channel, indicating to a separate
|
// Close the discoverySignal channel, indicating to a separate
|
||||||
// goroutine that the channel now is marked as open in the database
|
// goroutine that the channel now is marked as open in the database
|
||||||
// and that it is acceptable to process funding locked messages
|
// and that it is acceptable to process channel_ready messages
|
||||||
// from the peer.
|
// from the peer.
|
||||||
f.localDiscoveryMtx.Lock()
|
f.localDiscoveryMtx.Lock()
|
||||||
if discoverySignal, ok := f.localDiscoverySignals[chanID]; ok {
|
if discoverySignal, ok := f.localDiscoverySignals[chanID]; ok {
|
||||||
|
@ -2929,7 +2929,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel,
|
||||||
var peerKey [33]byte
|
var peerKey [33]byte
|
||||||
copy(peerKey[:], completeChan.IdentityPub.SerializeCompressed())
|
copy(peerKey[:], completeChan.IdentityPub.SerializeCompressed())
|
||||||
|
|
||||||
// Next, we'll send over the funding locked message which marks that we
|
// Next, we'll send over the channel_ready message which marks that we
|
||||||
// consider the channel open by presenting the remote party with our
|
// consider the channel open by presenting the remote party with our
|
||||||
// next revocation key. Without the revocation key, the remote party
|
// next revocation key. Without the revocation key, the remote party
|
||||||
// will be unable to propose state transitions.
|
// will be unable to propose state transitions.
|
||||||
|
@ -3451,7 +3451,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer,
|
||||||
"peer %x", msg.ChanID,
|
"peer %x", msg.ChanID,
|
||||||
peer.IdentityKey().SerializeCompressed())
|
peer.IdentityKey().SerializeCompressed())
|
||||||
|
|
||||||
// If we are currently in the process of handling a funding locked
|
// If we are currently in the process of handling a channel_ready
|
||||||
// message for this channel, ignore.
|
// message for this channel, ignore.
|
||||||
f.handleChannelReadyMtx.Lock()
|
f.handleChannelReadyMtx.Lock()
|
||||||
_, ok := f.handleChannelReadyBarriers[msg.ChanID]
|
_, ok := f.handleChannelReadyBarriers[msg.ChanID]
|
||||||
|
@ -3478,7 +3478,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer,
|
||||||
f.localDiscoveryMtx.Unlock()
|
f.localDiscoveryMtx.Unlock()
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
// Before we proceed with processing the funding locked
|
// Before we proceed with processing the channel_ready
|
||||||
// message, we'll wait for the local waitForFundingConfirmation
|
// message, we'll wait for the local waitForFundingConfirmation
|
||||||
// goroutine to signal that it has the necessary state in
|
// goroutine to signal that it has the necessary state in
|
||||||
// place. Otherwise, we may be missing critical information
|
// place. Otherwise, we may be missing critical information
|
||||||
|
@ -3596,7 +3596,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// The funding locked message contains the next commitment point we'll
|
// The channel_ready message contains the next commitment point we'll
|
||||||
// need to create the next commitment state for the remote party. So
|
// need to create the next commitment state for the remote party. So
|
||||||
// we'll insert that into the channel now before passing it along to
|
// we'll insert that into the channel now before passing it along to
|
||||||
// other sub-systems.
|
// other sub-systems.
|
||||||
|
|
|
@ -1412,7 +1412,7 @@ func TestFundingManagerNormalWorkflow(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -1679,7 +1679,7 @@ func TestFundingManagerRestartBehavior(t *testing.T) {
|
||||||
// Expected.
|
// Expected.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bob will send funding locked to Alice.
|
// Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -1838,7 +1838,7 @@ func TestFundingManagerOfflinePeer(t *testing.T) {
|
||||||
// Expected.
|
// Expected.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bob will send funding locked to Alice
|
// Bob will send channel_ready to Alice
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -2323,7 +2323,7 @@ func TestFundingManagerReceiveChannelReadyTwice(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -2342,7 +2342,7 @@ func TestFundingManagerReceiveChannelReadyTwice(t *testing.T) {
|
||||||
assertHandleChannelReady(t, alice, bob)
|
assertHandleChannelReady(t, alice, bob)
|
||||||
|
|
||||||
// Alice should not send the channel state the second time, as the
|
// Alice should not send the channel state the second time, as the
|
||||||
// second funding locked should just be ignored.
|
// second channel_ready should just be ignored.
|
||||||
select {
|
select {
|
||||||
case <-alice.newChannels:
|
case <-alice.newChannels:
|
||||||
t.Fatalf("alice sent new channel to peer a second time")
|
t.Fatalf("alice sent new channel to peer a second time")
|
||||||
|
@ -2436,7 +2436,7 @@ func TestFundingManagerRestartAfterChanAnn(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -2535,7 +2535,7 @@ func TestFundingManagerRestartAfterReceivingChannelReady(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -2630,7 +2630,7 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -2755,7 +2755,7 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
@ -3192,7 +3192,7 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send channel_ready to Alice.
|
||||||
channelReadyBob, ok := assertFundingMsgSent(
|
channelReadyBob, ok := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "ChannelReady",
|
t, bob.msgChan, "ChannelReady",
|
||||||
).(*lnwire.ChannelReady)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
|
@ -722,7 +722,7 @@ func (l *channelLink) syncChanStates() error {
|
||||||
|
|
||||||
// If the remote party indicates that they think we haven't
|
// If the remote party indicates that they think we haven't
|
||||||
// done any state updates yet, then we'll retransmit the
|
// done any state updates yet, then we'll retransmit the
|
||||||
// funding locked message first. We do this, as at this point
|
// channel_ready message first. We do this, as at this point
|
||||||
// we can't be sure if they've really received the
|
// we can't be sure if they've really received the
|
||||||
// ChannelReady message.
|
// ChannelReady message.
|
||||||
if remoteChanSyncMsg.NextLocalCommitHeight == 1 &&
|
if remoteChanSyncMsg.NextLocalCommitHeight == 1 &&
|
||||||
|
@ -1091,7 +1091,7 @@ func (l *channelLink) htlcManager() {
|
||||||
// allow the switch to forward HTLCs in the outbound direction.
|
// allow the switch to forward HTLCs in the outbound direction.
|
||||||
l.markReestablished()
|
l.markReestablished()
|
||||||
|
|
||||||
// Now that we've received both funding locked and channel reestablish,
|
// Now that we've received both channel_ready and channel reestablish,
|
||||||
// we can go ahead and send the active channel notification. We'll also
|
// we can go ahead and send the active channel notification. We'll also
|
||||||
// defer the inactive notification for when the link exits to ensure
|
// defer the inactive notification for when the link exits to ensure
|
||||||
// that every active notification is matched by an inactive one.
|
// that every active notification is matched by an inactive one.
|
||||||
|
|
|
@ -115,7 +115,7 @@ func TestSwitchHasActiveLink(t *testing.T) {
|
||||||
t.Fatalf("link should not be active yet, still pending")
|
t.Fatalf("link should not be active yet, still pending")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, simulate the link receiving funding locked by setting its
|
// Finally, simulate the link receiving channel_ready by setting its
|
||||||
// eligibility to true.
|
// eligibility to true.
|
||||||
aliceChannelLink.eligible = true
|
aliceChannelLink.eligible = true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue