-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
channel closingRelated to the closing of channels cooperatively and uncooperativelyRelated to the closing of channels cooperatively and uncooperativelydatabaseRelated to the database/storage of LNDRelated to the database/storage of LNDenhancementImprovements to existing features / behaviourImprovements to existing features / behaviourintermediateIssues suitable for developers moderately familiar with the codebase and LNIssues suitable for developers moderately familiar with the codebase and LNrpcRelated to the RPC interfaceRelated to the RPC interface
Milestone
Description
There exist three states of pending funds within lnd as it's writen today:
- A channel funding workflow has completed, and a channel is about to be "open". The funds are in limbo until the channel reaches
Nconfirmations. - A channel has been cooperatively closed, and the funds are in limbo until the closure transaction reaches a single confirmation.
- A channel has been unilaterally (forcibly) closed, and the funds are in limbo until
Tblocks have passed, and the time-lock sweeping transaction enters the chain.
Currently the PendingChannels RPC only shows the channels that are about to be opened and are awaiting N confirmations before they're considered open. The proto itself PendingChannelResponse includes an enum for each pending channel which tells if the channel is being opened or closed. Currently, only channels that are in the process of being opened are display in the response to the request. In order to give higher level applications and wallets more visibility into the various states that funds within lnd can idle in, the RPC response should be extended to display more granular information w.r.t "pending funds" in lnd's wallet.
Steps To Completion
- Expand the concept of "close summaries" (a distinct
dbbucket)within the database to also include the following information:- If the channel was closed forcibly or cooperatively.
- The total amount of funds allocated to us (including HTLC's) within the commitment transaction when the channel was closed.
- Callers that close a channel should use a newly updated version of
CloseChannelwhich toggles if the channel was closed forcibly or cooperatively. - A bool should be addd to the close summary which details if the "closing" process is still pending or active. This would be similar to the
MarkChannelPendingandMarkChannelOpenmethods for thechanneldb.OpenChannelstruct. Once the channel has been fully closed, then most of the limbo balance data in the close channel bucket can safely be deleted, and replaced with either: just the closing txtxid, and the closingtxid+ the sweeping channeltxid. - The
PendingChannelsRPC should be expanded to scan the database for channels still actively undergoing closing, and populate the RPC's accordingly based off of this data. This will populate the item listed as#2in the list above. - With the above completed, two areas in the codebase will need to be modified in order to properly manage the channel closure states within the database: the
peerstruct, and theutxoNursery.- Once the
peerstruct initiates a cooperative channel closure, the target channel should be marked as closed. - Once the
utxoNurserygraduates (sweeps) a set of outputs, the channels swept would me themselves marked as closed.
- Once the
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
channel closingRelated to the closing of channels cooperatively and uncooperativelyRelated to the closing of channels cooperatively and uncooperativelydatabaseRelated to the database/storage of LNDRelated to the database/storage of LNDenhancementImprovements to existing features / behaviourImprovements to existing features / behaviourintermediateIssues suitable for developers moderately familiar with the codebase and LNIssues suitable for developers moderately familiar with the codebase and LNrpcRelated to the RPC interfaceRelated to the RPC interface