Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/release-notes/release-notes-0.22.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@

## RPC Updates

* The `PendingChannels` response now [includes the short channel
id](https://github.com/lightningnetwork/lnd/pull/5575) of channels in the
`waiting_close_channels` and `pending_force_closing_channels` lists, so a
channel can be correlated with earlier `ListChannels` output without having
to match on the channel point.

## lncli Updates

## Breaking Changes
Expand Down
14 changes: 14 additions & 0 deletions itest/lnd_onchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
},
)

// Grab the short channel ID while the channel is still open so we can
// assert it's echoed back once the channel is pending close.
chanID := ht.GetChannelByChanPoint(alice, aliceChanPoint1).ChanId

// Send another UTXO if this is a neutrino backend. When sweeping
// anchors, there are two transactions created, `local_sweep_tx` for
// sweeping Alice's anchor on the local commitment, `remote_sweep_tx`
Expand Down Expand Up @@ -456,6 +460,11 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
require.Equal(ht, testMemo,
pendingChannelsResp.WaitingCloseChannels[0].Channel.Memo)

// The short channel ID should also be returned while the channel is
// waiting close.
require.Equal(ht, chanID,
pendingChannelsResp.WaitingCloseChannels[0].ChanId)

// At this point, the channel is waiting close so we have the
// commitment transaction in the mempool. Alice's anchor, however,
// because there's no deadline pressure, it won't be swept.
Expand Down Expand Up @@ -539,6 +548,11 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
require.Equal(ht, testMemo,
pendingChannelsResp.PendingForceClosingChannels[0].Channel.Memo)

// Same for the pending force close case, the short channel ID is
// carried over from the close summary.
require.Equal(ht, chanID,
pendingChannelsResp.PendingForceClosingChannels[0].ChanId)

// 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
37 changes: 29 additions & 8 deletions lnrpc/lightning.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lnrpc/lightning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2860,6 +2860,9 @@ message PendingChannelsResponse {
if this information is not available for older channels.
*/
uint32 close_height = 7;

// The unique channel ID for the channel.
uint64 chan_id = 8 [jstype = JS_STRING];
}

message Commitments {
Expand Down Expand Up @@ -2939,6 +2942,9 @@ message PendingChannelsResponse {
}

AnchorState anchor = 9;

// The unique channel ID for the channel.
uint64 chan_id = 10 [jstype = JS_STRING];
}

// The balance in satoshis encumbered in pending channels
Expand Down
10 changes: 10 additions & 0 deletions lnrpc/lightning.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3205,6 +3205,11 @@
},
"anchor": {
"$ref": "#/definitions/ForceClosedChannelAnchorState"
},
"chan_id": {
"type": "string",
"format": "uint64",
"description": "The unique channel ID for the channel."
}
}
},
Expand Down Expand Up @@ -3343,6 +3348,11 @@
"type": "integer",
"format": "int64",
"description": "The block height at which the closing transaction was first confirmed.\nThis will be zero if the closing transaction has not yet confirmed, or\nif this information is not available for older channels."
},
"chan_id": {
"type": "string",
"format": "uint64",
"description": "The unique channel ID for the channel."
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4233,6 +4233,7 @@ func (r *rpcServer) fetchPendingForceCloseChannels() (pendingForceClose,
}

closeTXID := pendingClose.ClosingTXID.String()
closeChanID := pendingClose.ShortChanID.ToUint64()

switch pendingClose.CloseType {

Expand All @@ -4253,6 +4254,7 @@ func (r *rpcServer) fetchPendingForceCloseChannels() (pendingForceClose,
forceClose := &lnrpc.PendingChannelsResponse_ForceClosedChannel{
Channel: channel,
ClosingTxid: closeTXID,
ChanId: closeChanID,
}

// Fetch reports from both nursery and resolvers. At the
Expand Down Expand Up @@ -4509,6 +4511,7 @@ func (r *rpcServer) fetchWaitingCloseChannels(
ClosingTxid: closingTxid,
ClosingTxHex: closingTxHex,
BlocksTilCloseConfirmed: blocksTilCloseConfirmed,
ChanId: waitingClose.ShortChannelID.ToUint64(),
CloseHeight: waitingClose.CloseConfirmationHeight.
UnwrapOr(0),
}
Expand Down
Loading