ElementsProject / ElementsProject/lightning

Unspendable TXO Finder

Open
#9,133 3 comments 0 reactions 1 assignee Claimed by @ddustin View on GitHub
Dominant language
C
Stars
3.1k
Forks
1k
Avg merge
4d 10h
Merged PRs (30d)
13

Description

## 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

See https://github.com/ksedgwic/clboss/issues/312 for an example

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.