multi: replace FundingLocked and funding_locked strings
This commit is created by running the following commands,
```shell
find . -name "*.go" -exec sed -i '' 's/\"FundingLocked/\"ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLocked\"/ChannelReady\"/g' {} \;
find . -name "*.go" -exec sed -i '' 's/\ funding_locked/\ channel_ready/g' {} \;
```
This commit is contained in:
9 files changed
+51
-51
No files matched your search
@@ -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)
|
||||
|
||||
|
||||
+9
-9
@@ -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
|
||||
|
||||
+25
-25
@@ -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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user