mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-23 23:31:02 +02:00
Merge pull request #7728 from shaurya947/memo-pending-channels
lnrpc+itest: return channel Memo for Pending channels
This commit is contained in:
commit
02c1261a3d
@ -459,6 +459,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
const (
|
const (
|
||||||
firstChanSize = 1_000_000
|
firstChanSize = 1_000_000
|
||||||
anchorFeeBuffer = 500_000
|
anchorFeeBuffer = 500_000
|
||||||
|
testMemo = "bob is a good peer"
|
||||||
)
|
)
|
||||||
ht.FundCoins(firstChanSize+anchorFeeBuffer, alice)
|
ht.FundCoins(firstChanSize+anchorFeeBuffer, alice)
|
||||||
|
|
||||||
@ -467,6 +468,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
aliceChanPoint1 := ht.OpenChannel(
|
aliceChanPoint1 := ht.OpenChannel(
|
||||||
alice, bob, lntest.OpenChannelParams{
|
alice, bob, lntest.OpenChannelParams{
|
||||||
Amt: firstChanSize,
|
Amt: firstChanSize,
|
||||||
|
Memo: testMemo,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -509,6 +511,12 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
// PendingChannels RPC under the waiting close section.
|
// PendingChannels RPC under the waiting close section.
|
||||||
waitingClose := ht.AssertChannelWaitingClose(alice, aliceChanPoint1)
|
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
|
// At this point, the channel is waiting close, and we have both the
|
||||||
// commitment transaction and anchor sweep in the mempool.
|
// commitment transaction and anchor sweep in the mempool.
|
||||||
const expectedTxns = 2
|
const expectedTxns = 2
|
||||||
@ -531,6 +539,12 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
// on the number of anchor channels.
|
// on the number of anchor channels.
|
||||||
ht.AssertChannelPendingForceClose(alice, aliceChanPoint1)
|
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
|
// 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
|
// instruct the wallet to send all coins in the wallet to a new address
|
||||||
// (to the miner), including unconfirmed change.
|
// (to the miner), including unconfirmed change.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2556,6 +2556,13 @@ message PendingChannelsResponse {
|
|||||||
|
|
||||||
// Whether this channel is advertised to the network or not.
|
// Whether this channel is advertised to the network or not.
|
||||||
bool private = 12;
|
bool private = 12;
|
||||||
|
|
||||||
|
/*
|
||||||
|
An optional note-to-self to go along with the channel containing some
|
||||||
|
useful information. This is only ever stored locally and in no way
|
||||||
|
impacts the channel's operation.
|
||||||
|
*/
|
||||||
|
string memo = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PendingOpenChannel {
|
message PendingOpenChannel {
|
||||||
|
@ -3028,6 +3028,10 @@
|
|||||||
"private": {
|
"private": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Whether this channel is advertised to the network or not."
|
"description": "Whether this channel is advertised to the network or not."
|
||||||
|
},
|
||||||
|
"memo": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional note-to-self to go along with the channel containing some\nuseful information. This is only ever stored locally and in no way\nimpacts the channel's operation."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3424,6 +3424,7 @@ func (r *rpcServer) fetchPendingOpenChannels() (pendingOpenChannels, error) {
|
|||||||
Initiator: rpcInitiator(pendingChan.IsInitiator),
|
Initiator: rpcInitiator(pendingChan.IsInitiator),
|
||||||
CommitmentType: rpcCommitmentType(pendingChan.ChanType),
|
CommitmentType: rpcCommitmentType(pendingChan.ChanType),
|
||||||
Private: isPrivate(pendingChan),
|
Private: isPrivate(pendingChan),
|
||||||
|
Memo: string(pendingChan.Memo),
|
||||||
},
|
},
|
||||||
CommitWeight: commitWeight,
|
CommitWeight: commitWeight,
|
||||||
CommitFee: int64(localCommitment.CommitFee),
|
CommitFee: int64(localCommitment.CommitFee),
|
||||||
@ -3513,6 +3514,7 @@ func (r *rpcServer) fetchPendingForceCloseChannels() (pendingForceClose,
|
|||||||
)
|
)
|
||||||
|
|
||||||
channel.Private = isPrivate(historical)
|
channel.Private = isPrivate(historical)
|
||||||
|
channel.Memo = string(historical.Memo)
|
||||||
|
|
||||||
// If the error is non-nil, and not due to older versions of lnd
|
// If the error is non-nil, and not due to older versions of lnd
|
||||||
// not persisting historical channels, return it.
|
// not persisting historical channels, return it.
|
||||||
@ -3715,6 +3717,7 @@ func (r *rpcServer) fetchWaitingCloseChannels() (waitingCloseChannels,
|
|||||||
NumForwardingPackages: int64(len(fwdPkgs)),
|
NumForwardingPackages: int64(len(fwdPkgs)),
|
||||||
ChanStatusFlags: waitingClose.ChanStatus().String(),
|
ChanStatusFlags: waitingClose.ChanStatus().String(),
|
||||||
Private: isPrivate(waitingClose),
|
Private: isPrivate(waitingClose),
|
||||||
|
Memo: string(waitingClose.Memo),
|
||||||
}
|
}
|
||||||
|
|
||||||
waitingCloseResp := &lnrpc.PendingChannelsResponse_WaitingCloseChannel{
|
waitingCloseResp := &lnrpc.PendingChannelsResponse_WaitingCloseChannel{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user