multi: rename FundingLocked to ChannelReady
This commit is created by running, ```shell gofmt -d -w -r 'FundingLocked -> ChannelReady' . gco master channeldb/migration ```
This commit is contained in:
10 files changed
+51
-51
No files matched your search
+2
-2
@@ -889,7 +889,7 @@ func (f *Manager) reservationCoordinator() {
|
|||||||
case *lnwire.FundingSigned:
|
case *lnwire.FundingSigned:
|
||||||
f.handleFundingSigned(fmsg.peer, msg)
|
f.handleFundingSigned(fmsg.peer, msg)
|
||||||
|
|
||||||
case *lnwire.FundingLocked:
|
case *lnwire.ChannelReady:
|
||||||
f.wg.Add(1)
|
f.wg.Add(1)
|
||||||
go f.handleFundingLocked(fmsg.peer, msg)
|
go f.handleFundingLocked(fmsg.peer, msg)
|
||||||
|
|
||||||
@@ -3394,7 +3394,7 @@ func (f *Manager) waitForZeroConfChannel(c *channeldb.OpenChannel,
|
|||||||
// handleFundingLocked finalizes the channel funding process and enables the
|
// handleFundingLocked finalizes the channel funding process and enables the
|
||||||
// channel to enter normal operating mode.
|
// channel to enter normal operating mode.
|
||||||
func (f *Manager) handleFundingLocked(peer lnpeer.Peer,
|
func (f *Manager) handleFundingLocked(peer lnpeer.Peer,
|
||||||
msg *lnwire.FundingLocked) {
|
msg *lnwire.ChannelReady) {
|
||||||
|
|
||||||
defer f.wg.Done()
|
defer f.wg.Done()
|
||||||
log.Debugf("Received FundingLocked for ChannelID(%v) from "+
|
log.Debugf("Received FundingLocked for ChannelID(%v) from "+
|
||||||
|
|||||||
+23
-23
@@ -901,7 +901,7 @@ func assertFundingMsgSent(t *testing.T, msgChan chan lnwire.Message,
|
|||||||
case "FundingSigned":
|
case "FundingSigned":
|
||||||
sentMsg, ok = msg.(*lnwire.FundingSigned)
|
sentMsg, ok = msg.(*lnwire.FundingSigned)
|
||||||
case "FundingLocked":
|
case "FundingLocked":
|
||||||
sentMsg, ok = msg.(*lnwire.FundingLocked)
|
sentMsg, ok = msg.(*lnwire.ChannelReady)
|
||||||
case "Error":
|
case "Error":
|
||||||
sentMsg, ok = msg.(*lnwire.Error)
|
sentMsg, ok = msg.(*lnwire.Error)
|
||||||
default:
|
default:
|
||||||
@@ -1408,12 +1408,12 @@ func TestFundingManagerNormalWorkflow(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Check that the state machine is updated accordingly
|
// Check that the state machine is updated accordingly
|
||||||
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
||||||
@@ -1679,7 +1679,7 @@ func TestFundingManagerRestartBehavior(t *testing.T) {
|
|||||||
// Bob will send funding locked to Alice.
|
// Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Alice should still be markedOpen
|
// Alice should still be markedOpen
|
||||||
assertDatabaseState(t, alice, fundingOutPoint, markedOpen)
|
assertDatabaseState(t, alice, fundingOutPoint, markedOpen)
|
||||||
@@ -1708,7 +1708,7 @@ func TestFundingManagerRestartBehavior(t *testing.T) {
|
|||||||
|
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// The state should now be fundingLockedSent
|
// The state should now be fundingLockedSent
|
||||||
assertDatabaseState(t, alice, fundingOutPoint, fundingLockedSent)
|
assertDatabaseState(t, alice, fundingOutPoint, fundingLockedSent)
|
||||||
@@ -1836,7 +1836,7 @@ func TestFundingManagerOfflinePeer(t *testing.T) {
|
|||||||
// Bob will send funding locked to Alice
|
// Bob will send funding locked to Alice
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Alice should still be markedOpen
|
// Alice should still be markedOpen
|
||||||
assertDatabaseState(t, alice, fundingOutPoint, markedOpen)
|
assertDatabaseState(t, alice, fundingOutPoint, markedOpen)
|
||||||
@@ -1884,7 +1884,7 @@ func TestFundingManagerOfflinePeer(t *testing.T) {
|
|||||||
// This should make Alice send the fundingLocked.
|
// This should make Alice send the fundingLocked.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// The state should now be fundingLockedSent
|
// The state should now be fundingLockedSent
|
||||||
assertDatabaseState(t, alice, fundingOutPoint, fundingLockedSent)
|
assertDatabaseState(t, alice, fundingOutPoint, fundingLockedSent)
|
||||||
@@ -2313,12 +2313,12 @@ func TestFundingManagerReceiveFundingLockedTwice(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Check that the state machine is updated accordingly
|
// Check that the state machine is updated accordingly
|
||||||
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
||||||
@@ -2424,12 +2424,12 @@ func TestFundingManagerRestartAfterChanAnn(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Check that the state machine is updated accordingly
|
// Check that the state machine is updated accordingly
|
||||||
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
||||||
@@ -2521,12 +2521,12 @@ func TestFundingManagerRestartAfterReceivingFundingLocked(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Check that the state machine is updated accordingly
|
// Check that the state machine is updated accordingly
|
||||||
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
||||||
@@ -2614,12 +2614,12 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Check that the state machine is updated accordingly
|
// Check that the state machine is updated accordingly
|
||||||
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
||||||
@@ -2737,12 +2737,12 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Check that the state machine is updated accordingly
|
// Check that the state machine is updated accordingly
|
||||||
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
assertFundingLockedSent(t, alice, bob, fundingOutPoint)
|
||||||
@@ -3172,12 +3172,12 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
|
|||||||
// fundingLocked to Bob.
|
// fundingLocked to Bob.
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// And similarly Bob will send funding locked to Alice.
|
// And similarly Bob will send funding locked to Alice.
|
||||||
fundingLockedBob := assertFundingMsgSent(
|
fundingLockedBob := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
// Exchange the fundingLocked messages.
|
// Exchange the fundingLocked messages.
|
||||||
alice.fundingMgr.ProcessFundingMsg(fundingLockedBob, bob)
|
alice.fundingMgr.ProcessFundingMsg(fundingLockedBob, bob)
|
||||||
@@ -3489,11 +3489,11 @@ func TestFundingManagerMaxPendingChannels(t *testing.T) {
|
|||||||
// Expect both to be sending FundingLocked.
|
// Expect both to be sending FundingLocked.
|
||||||
_ = assertFundingMsgSent(
|
_ = assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
_ = assertFundingMsgSent(
|
_ = assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4205,14 +4205,14 @@ func TestFundingManagerZeroConf(t *testing.T) {
|
|||||||
// Assert that Bob's funding_locked message has an AliasScid.
|
// Assert that Bob's funding_locked message has an AliasScid.
|
||||||
bobFundingLocked := assertFundingMsgSent(
|
bobFundingLocked := assertFundingMsgSent(
|
||||||
t, bob.msgChan, "FundingLocked",
|
t, bob.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
require.NotNil(t, bobFundingLocked.AliasScid)
|
require.NotNil(t, bobFundingLocked.AliasScid)
|
||||||
require.Equal(t, *bobFundingLocked.AliasScid, alias)
|
require.Equal(t, *bobFundingLocked.AliasScid, alias)
|
||||||
|
|
||||||
// Do the same for Alice as well.
|
// Do the same for Alice as well.
|
||||||
aliceFundingLocked := assertFundingMsgSent(
|
aliceFundingLocked := assertFundingMsgSent(
|
||||||
t, alice.msgChan, "FundingLocked",
|
t, alice.msgChan, "FundingLocked",
|
||||||
).(*lnwire.FundingLocked)
|
).(*lnwire.ChannelReady)
|
||||||
require.NotNil(t, aliceFundingLocked.AliasScid)
|
require.NotNil(t, aliceFundingLocked.AliasScid)
|
||||||
require.Equal(t, *aliceFundingLocked.AliasScid, alias)
|
require.Equal(t, *aliceFundingLocked.AliasScid, alias)
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -1684,8 +1684,8 @@ func TestChannelLinkSingleHopMessageOrdering(t *testing.T) {
|
|||||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.UpdateAddHTLC{}, false},
|
{"alice", "bob", &lnwire.UpdateAddHTLC{}, false},
|
||||||
{"alice", "bob", &lnwire.CommitSig{}, false},
|
{"alice", "bob", &lnwire.CommitSig{}, false},
|
||||||
@@ -3303,8 +3303,8 @@ func TestChannelRetransmission(t *testing.T) {
|
|||||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||||
|
|
||||||
// Send payment from Alice to Bob and intercept
|
// Send payment from Alice to Bob and intercept
|
||||||
// the last revocation message, in this case
|
// the last revocation message, in this case
|
||||||
@@ -3343,8 +3343,8 @@ func TestChannelRetransmission(t *testing.T) {
|
|||||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||||
|
|
||||||
// Send payment from Alice to Bob and intercept
|
// Send payment from Alice to Bob and intercept
|
||||||
// the last revocation message, in this case
|
// the last revocation message, in this case
|
||||||
@@ -3385,8 +3385,8 @@ func TestChannelRetransmission(t *testing.T) {
|
|||||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||||
|
|
||||||
// Attempt make a payment from Alice to Bob,
|
// Attempt make a payment from Alice to Bob,
|
||||||
// which is intercepted, emulating the Bob
|
// which is intercepted, emulating the Bob
|
||||||
@@ -3399,8 +3399,8 @@ func TestChannelRetransmission(t *testing.T) {
|
|||||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||||
|
|
||||||
// After Bob has notified Alice that he didn't
|
// After Bob has notified Alice that he didn't
|
||||||
// receive updates Alice should re-send them.
|
// receive updates Alice should re-send them.
|
||||||
@@ -3816,8 +3816,8 @@ func TestChannelLinkUpdateCommitFee(t *testing.T) {
|
|||||||
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
{"alice", "bob", &lnwire.ChannelReestablish{}, false},
|
||||||
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
{"bob", "alice", &lnwire.ChannelReestablish{}, false},
|
||||||
|
|
||||||
{"alice", "bob", &lnwire.FundingLocked{}, false},
|
{"alice", "bob", &lnwire.ChannelReady{}, false},
|
||||||
{"bob", "alice", &lnwire.FundingLocked{}, false},
|
{"bob", "alice", &lnwire.ChannelReady{}, false},
|
||||||
|
|
||||||
// First fee update.
|
// First fee update.
|
||||||
{"alice", "bob", &lnwire.UpdateFee{}, false},
|
{"alice", "bob", &lnwire.UpdateFee{}, false},
|
||||||
|
|||||||
+1
-1
@@ -627,7 +627,7 @@ func (s *mockServer) readHandler(message lnwire.Message) error {
|
|||||||
targetChan = msg.ChanID
|
targetChan = msg.ChanID
|
||||||
case *lnwire.CommitSig:
|
case *lnwire.CommitSig:
|
||||||
targetChan = msg.ChanID
|
targetChan = msg.ChanID
|
||||||
case *lnwire.FundingLocked:
|
case *lnwire.ChannelReady:
|
||||||
// Ignore
|
// Ignore
|
||||||
return nil
|
return nil
|
||||||
case *lnwire.ChannelReestablish:
|
case *lnwire.ChannelReestablish:
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ func getChanID(msg lnwire.Message) (lnwire.ChannelID, error) {
|
|||||||
chanID = msg.ChanID
|
chanID = msg.ChanID
|
||||||
case *lnwire.ChannelReestablish:
|
case *lnwire.ChannelReestablish:
|
||||||
chanID = msg.ChanID
|
chanID = msg.ChanID
|
||||||
case *lnwire.FundingLocked:
|
case *lnwire.ChannelReady:
|
||||||
chanID = msg.ChanID
|
chanID = msg.ChanID
|
||||||
case *lnwire.UpdateFee:
|
case *lnwire.UpdateFee:
|
||||||
chanID = msg.ChanID
|
chanID = msg.ChanID
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
// blockchain. FundingLocked contains the signatures necessary for the channel
|
// blockchain. FundingLocked contains the signatures necessary for the channel
|
||||||
// participants to advertise the existence of the channel to the rest of the
|
// participants to advertise the existence of the channel to the rest of the
|
||||||
// network.
|
// network.
|
||||||
type FundingLocked struct {
|
type ChannelReady struct {
|
||||||
// ChanID is the outpoint of the channel's funding transaction. This
|
// ChanID is the outpoint of the channel's funding transaction. This
|
||||||
// can be used to query for the channel in the database.
|
// can be used to query for the channel in the database.
|
||||||
ChanID ChannelID
|
ChanID ChannelID
|
||||||
@@ -35,8 +35,8 @@ type FundingLocked struct {
|
|||||||
|
|
||||||
// NewFundingLocked creates a new FundingLocked message, populating it with the
|
// NewFundingLocked creates a new FundingLocked message, populating it with the
|
||||||
// necessary IDs and revocation secret.
|
// necessary IDs and revocation secret.
|
||||||
func NewFundingLocked(cid ChannelID, npcp *btcec.PublicKey) *FundingLocked {
|
func NewFundingLocked(cid ChannelID, npcp *btcec.PublicKey) *ChannelReady {
|
||||||
return &FundingLocked{
|
return &ChannelReady{
|
||||||
ChanID: cid,
|
ChanID: cid,
|
||||||
NextPerCommitmentPoint: npcp,
|
NextPerCommitmentPoint: npcp,
|
||||||
ExtraData: make([]byte, 0),
|
ExtraData: make([]byte, 0),
|
||||||
@@ -45,14 +45,14 @@ func NewFundingLocked(cid ChannelID, npcp *btcec.PublicKey) *FundingLocked {
|
|||||||
|
|
||||||
// A compile time check to ensure FundingLocked implements the lnwire.Message
|
// A compile time check to ensure FundingLocked implements the lnwire.Message
|
||||||
// interface.
|
// interface.
|
||||||
var _ Message = (*FundingLocked)(nil)
|
var _ Message = (*ChannelReady)(nil)
|
||||||
|
|
||||||
// Decode deserializes the serialized FundingLocked message stored in the
|
// Decode deserializes the serialized FundingLocked message stored in the
|
||||||
// passed io.Reader into the target FundingLocked using the deserialization
|
// passed io.Reader into the target FundingLocked using the deserialization
|
||||||
// rules defined by the passed protocol version.
|
// rules defined by the passed protocol version.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *FundingLocked) Decode(r io.Reader, pver uint32) error {
|
func (c *ChannelReady) Decode(r io.Reader, pver uint32) error {
|
||||||
// Read all the mandatory fields in the message.
|
// Read all the mandatory fields in the message.
|
||||||
err := ReadElements(r,
|
err := ReadElements(r,
|
||||||
&c.ChanID,
|
&c.ChanID,
|
||||||
@@ -85,7 +85,7 @@ func (c *FundingLocked) Decode(r io.Reader, pver uint32) error {
|
|||||||
// protocol version.
|
// protocol version.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *FundingLocked) Encode(w *bytes.Buffer, pver uint32) error {
|
func (c *ChannelReady) Encode(w *bytes.Buffer, pver uint32) error {
|
||||||
if err := WriteChannelID(w, c.ChanID); err != nil {
|
if err := WriteChannelID(w, c.ChanID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -110,6 +110,6 @@ func (c *FundingLocked) Encode(w *bytes.Buffer, pver uint32) error {
|
|||||||
// FundingLocked message on the wire.
|
// FundingLocked message on the wire.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (c *FundingLocked) MsgType() MessageType {
|
func (c *ChannelReady) MsgType() MessageType {
|
||||||
return MsgFundingLocked
|
return MsgFundingLocked
|
||||||
}
|
}
|
||||||
@@ -1014,7 +1014,7 @@ func TestLightningWireProtocol(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
msgType: MsgFundingLocked,
|
msgType: MsgFundingLocked,
|
||||||
scenario: func(m FundingLocked) bool {
|
scenario: func(m ChannelReady) bool {
|
||||||
return mainScenario(&m)
|
return mainScenario(&m)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -191,7 +191,7 @@ func makeEmptyMessage(msgType MessageType) (Message, error) {
|
|||||||
case MsgFundingSigned:
|
case MsgFundingSigned:
|
||||||
msg = &FundingSigned{}
|
msg = &FundingSigned{}
|
||||||
case MsgFundingLocked:
|
case MsgFundingLocked:
|
||||||
msg = &FundingLocked{}
|
msg = &ChannelReady{}
|
||||||
case MsgShutdown:
|
case MsgShutdown:
|
||||||
msg = &Shutdown{}
|
msg = &Shutdown{}
|
||||||
case MsgClosingSigned:
|
case MsgClosingSigned:
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ func newMsgFundingSigned(t testing.TB, r io.Reader) *lnwire.FundingSigned {
|
|||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMsgFundingLocked(t testing.TB, r io.Reader) *lnwire.FundingLocked {
|
func newMsgFundingLocked(t testing.TB, r io.Reader) *lnwire.ChannelReady {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
var c [32]byte
|
var c [32]byte
|
||||||
|
|||||||
+2
-2
@@ -1545,7 +1545,7 @@ out:
|
|||||||
*lnwire.AcceptChannel,
|
*lnwire.AcceptChannel,
|
||||||
*lnwire.FundingCreated,
|
*lnwire.FundingCreated,
|
||||||
*lnwire.FundingSigned,
|
*lnwire.FundingSigned,
|
||||||
*lnwire.FundingLocked:
|
*lnwire.ChannelReady:
|
||||||
|
|
||||||
p.cfg.FundingManager.ProcessFundingMsg(msg, p)
|
p.cfg.FundingManager.ProcessFundingMsg(msg, p)
|
||||||
|
|
||||||
@@ -1794,7 +1794,7 @@ func messageSummary(msg lnwire.Message) string {
|
|||||||
case *lnwire.FundingSigned:
|
case *lnwire.FundingSigned:
|
||||||
return fmt.Sprintf("chan_id=%v", msg.ChanID)
|
return fmt.Sprintf("chan_id=%v", msg.ChanID)
|
||||||
|
|
||||||
case *lnwire.FundingLocked:
|
case *lnwire.ChannelReady:
|
||||||
return fmt.Sprintf("chan_id=%v, next_point=%x",
|
return fmt.Sprintf("chan_id=%v, next_point=%x",
|
||||||
msg.ChanID, msg.NextPerCommitmentPoint.SerializeCompressed())
|
msg.ChanID, msg.NextPerCommitmentPoint.SerializeCompressed())
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user