ElementsProject / ElementsProject/lightning
UTXO missing from wallet after a restart and an unwanted local force-close
- Dominant language
- C
- Stars
- 3.1k
- Forks
- 1k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 13
Description
After a restart of the node, it automatically force-closed a channel but an UTXO in the closing transaction (resulting from a pending HTLC) is missing in the output of `listfunds`.
```
CLN version: v25.12.1
Bitcoind version: 31.0
funding transaction: 7e907aa45a014c1666a5d1eefe98d4245b616abd02b9398d42293bc23aca2cce
closing transaction: 5bf58ab7e136d74d837472eaa907a5b3c508e4dfd8a20063c4814ebdddc1de4b
```
The closing transaction results in 5 outputs:
1. anchor
2. anchor
3. the missing unspent UTXO (215289 sats)
4. remaining funds of their side (1860779 sats)
5. remaining funds of our side (9922922 sats)
`listclosedchannels` shows we should own this UTXO:
```
"final_to_us_msat": 10138211724
```
`bkpr-listaccountevents` shows this output as `onchain_fee` :
```
{
"account": "ce2cca3ac23b29428d39b902bd6a615b24d498feeed1a566164c015aa47a907f",
"type": "onchain_fee",
"tag": "onchain_fee",
"credit_msat": 215289724,
"debit_msat": 0,
"currency": "bc",
"timestamp": 1780321071,
"txid": "5bf58ab7e136d74d837472eaa907a5b3c508e4dfd8a20063c4814ebdddc1de4b"
}
```
The logs of this channel just after I restarted CLN:
```
2026-06-01T12:30:39.470Z UNUSUAL 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: Peer permanent failure in CHANNELD_NORMAL: channeld: sent Awaiting unilateral close (reason=local)
2026-06-01T12:30:39.470Z INFO 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: State changed from CHANNELD_NORMAL to AWAITING_UNILATERAL
2026-06-01T12:30:39.472Z **BROKEN** 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: Cannot broadcast our commitment tx: they have a future one
2026-06-01T13:37:51.100Z UNUSUAL 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: Peer permanent failure in AWAITING_UNILATERAL: Funding transaction spent: onchain txid 5bf58ab7e136d74d837472eaa907a5b3c508e4dfd8a20063c4814ebdddc1de4b (reason=unknown)
2026-06-01T13:37:51.100Z **BROKEN** 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: Cannot broadcast our commitment tx: they have a future one
2026-06-01T13:37:51.100Z INFO 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: State changed from AWAITING_UNILATERAL to FUNDING_SPEND_SEEN
2026-06-01T13:37:51.129Z **BROKEN** 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-onchaind-chan#11240: ERROR: Unknown commitment #1457929, recovering our funds!
2026-06-01T13:37:51.129Z INFO 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: State changed from FUNDING_SPEND_SEEN to ONCHAIN
2026-06-02T07:38:44.777Z INFO 03a93b87bf9f052b8e862d51ebbac4ce5e97b5f4137563cd5128548d7f5978dda9-chan#11240: onchaind complete, forgetting peer
```
What I've tried:
- `dev-rescan-outputs`
- `--rescan` with a large value (before the funding transaction)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.