Skip to content

Commit

Permalink
Merge pull request #7728 from shaurya947/memo-pending-channels
Browse files Browse the repository at this point in the history
lnrpc+itest: return channel Memo for Pending channels
  • Loading branch information
guggero authored Jun 16, 2023
2 parents 2e1b659 + 44fdd02 commit 02c1261
Show file tree
Hide file tree
Showing 5 changed files with 1,807 additions and 1,767 deletions.
16 changes: 15 additions & 1 deletion itest/lnd_onchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,16 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
const (
firstChanSize = 1_000_000
anchorFeeBuffer = 500_000
testMemo = "bob is a good peer"
)
ht.FundCoins(firstChanSize+anchorFeeBuffer, alice)

// Open the channel between the two nodes and wait for it to confirm
// fully.
aliceChanPoint1 := ht.OpenChannel(
alice, bob, lntest.OpenChannelParams{
Amt: firstChanSize,
Amt: firstChanSize,
Memo: testMemo,
},
)

Expand Down Expand Up @@ -509,6 +511,12 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
// PendingChannels RPC under the waiting close section.
waitingClose := ht.AssertChannelWaitingClose(alice, aliceChanPoint1)

// Verify that the channel Memo is returned even for channels that are
// waiting close (close TX broadcasted but not confirmed)
pendingChannelsResp := alice.RPC.PendingChannels()
require.Equal(ht, testMemo,
pendingChannelsResp.WaitingCloseChannels[0].Channel.Memo)

// At this point, the channel is waiting close, and we have both the
// commitment transaction and anchor sweep in the mempool.
const expectedTxns = 2
Expand All @@ -531,6 +539,12 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
// on the number of anchor channels.
ht.AssertChannelPendingForceClose(alice, aliceChanPoint1)

// Verify that the channel Memo is returned even for channels that are
// pending force close (close TX confirmed but sweep hasn't happened)
pendingChannelsResp = alice.RPC.PendingChannels()
require.Equal(ht, testMemo,
pendingChannelsResp.PendingForceClosingChannels[0].Channel.Memo)

// With the anchor output located, and the main commitment mined we'll
// instruct the wallet to send all coins in the wallet to a new address
// (to the miner), including unconfirmed change.
Expand Down
Loading

0 comments on commit 02c1261

Please sign in to comment.