Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onchaind: replay using real block data, not db #7343

Merged

Conversation

rustyrussell
Copy link
Contributor

We have a report of onchaind not sweeping properly. It seems to be missing an output during replay, which makes sense since Greenlight restarts nodes (a lot!).

See Blockstream/greenlight#433

I've also got a similar issue on my node, but I assumed that was me corrupting the database by editing it long ago. I will, however, test this fix on my node too...

@rustyrussell
Copy link
Contributor Author

I rebased this, and added more protections against gossipd getting out of sync (if it doesn't process all the spent utxos before we stop).

@rustyrussell rustyrussell force-pushed the guilt/onchaind-replay branch 2 times, most recently from e977b18 to 34991a2 Compare November 11, 2024 05:08
Copy link
Contributor

@niftynei niftynei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 34991a2

moving away from the database saved txs is an awesome idea. made me really happy to see that switch block go away

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…g replay.

We start by telling onchaind about the funding spend, and anything
which spends it, and it tells us the txids it *doesn't* want to watch
any more.  We're going to use a separate set of watches for the replay
case: this implements that code.

Once we're caught up, we convert any remaining watches to normal ones
to follow future blocks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
And we hook in the replay watch code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `onchaind` can miss conclusion of final txs in some cases, will now replay independently.
Now we do replay, we don't need the others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
If it gets really far behind, then we restart, it could miss some.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This may help the cases we see where gossipd doesn't realize channels
are closed (because of shutdown before it processed the closing).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `gossipd` will no longer miss some channel closes on restart.
Useful if it's only to be used for the duration of the callback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This means it always tells us explicitly whether to keep watching or not,
and we know it's processed it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…lay.

Christian noted that if we don't do this we could flood onchaind with messages:
particularly in Greenlight where the HSM (remote) may delay indefinitely, so
onchaind doesn't process messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell merged commit d57accf into ElementsProject:master Nov 13, 2024
28 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants