Skip to content

Conversation

@rustyrussell
Copy link
Contributor

The critical "missing UTXOS" fix.

Changelog-None

At startup, we load the outpoints to watch, *then* roll back 15
blocks.  If there were things in those blocks we wanted to watch, we
no longer do!

1. We load the utxoset into memory: everything in the utxoset table
   which has spendheight null.
2. We roll back 15 blocks to re-read.  Deleting a block from the
   database causes the utxo spentheights referring to it to be set
   to null.
3. We roll forward, but we didn't update the in-memory utxoset,
   so we're not watching those utxos which are spent.

The main symptom of this is that we spam peers with obsolete gossip
(if we get sent a channel announcement for a closed channel, we can
think it isn't spent yet).  But it could *also* mean we don't notice
onchain txs, if we restart at the wrong time!

Changelog-Fixed: lightningd: we could miss tx spends which happened in the past blocks when we restarted.
Signed-off-by: Rusty Russell <[email protected]>
We only do this once, and not on new nodes.

Signed-off-by: Rusty Russell <[email protected]>
I took the node from the original test which missed the UTXO, and
added some more blocks.

Signed-off-by: Rusty Russell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant