Skip to content

Unspendable TXO Finder #9133

@ddustin

Description

@ddustin

The problem:

UTXOs can become unspendable TXOs. When they do, multiple systems in CLN remain in pending states that can confuse users.

This problem is particularly exasperated when users have lots of channels in many states as seen in #9102 and #9112

The solution:

A system that collects all inputs on SIGHASH_ALL tx's we care about (channel opens, splices, wallet activity) and monitors the chain for their inputs being spent. After some spending depth (100?) we move the corresponding tx state into a new NOT_POSSIBLE state. A state of this kind would need to exist for wallet UTXOs, channels, and inflights.

Then, when displaying user balances, we exclude the NOT_POSSIBLE items.

Importantly we should never delete these and if possible reorgs should move the items back into their old states.

  • Make system to track all inputs of wallet txs
    • When the txs confirm + some depth (100?), stop tracking them
  • Improve system to add channel open inflights
  • Improve system to add channel splice inflights
  • Add NOT_POSSIBLE state to wallet UTXOs
    • Hide NOT_POSSIBLE state UTXOs from user RPCs that show funds
    • Ignore NOT_POSSIBLE state UTXOs from all sources that acquire funds (utxopsbt, addpsbtinput, fundpsbt, etc)
  • Channel opens where the funding tx has become NOT_POSSIBLE
    • Force-close the channel
  • Channel splices where the inflight has become NOT_POSSIBLE
    • These must continue to be processed as per the spec, so channel stays in AWAITING_SPLICE
    • Show the inflight as NOT_POSSIBLE in the user RPC

Fixes #9102
Fixes #9112

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions