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

splice: prevent splice going to onchaind & race prevention #6564

Merged
merged 2 commits into from Aug 16, 2023

Conversation

ddustin
Copy link
Collaborator

@ddustin ddustin commented Aug 14, 2023

Don’t send the funding spend to onchaind if we detect it in inflights (aka. a splice). While we already prevented onchaind_funding_spent from being called directly, the call to wallet_channeltxs_add meant onchaind_funding_spent would be called anyway on restart. This is now fixed.

Additionally there was a potential for a race problem depending on the firing order of the channel depth and and funding spent events.

Instead of requiring these events fire in a specific order, we make a special “memory only” inflight object to prevent the race regardless of firing order.

Fixes #6533

@rustyrussell
Copy link
Contributor

This broke everything? test_splice.py is now timing out on every run.

You need to write some real tests.

@ddustin ddustin force-pushed the ddustin/splice_close_fix branch 3 times, most recently from ce20c0c to 0917e8e Compare August 15, 2023 01:36
@ddustin
Copy link
Collaborator Author

ddustin commented Aug 15, 2023

Added a regression test 7d54716 that will specifically check for what occured in Issue #6533 (splicing being detected as an incorrect channel close event, saving that event, and firing it upon restart).

@ddustin ddustin force-pushed the ddustin/splice_close_fix branch 2 times, most recently from 15949ba to 6cd14d4 Compare August 15, 2023 02:38
Don’t send the funding spend to onchaind if we detect it in inflights (aka. a splice). While we already prevented onchaind_funding_spent from being called directly, the call to wallet_channeltxs_add meant onchaind_funding_spent would be called *anyway* on restart. This is now fixed.

Additionally there was a potential for a race problem depending on the firing order of the channel depth and and funding spent events.

Instead of requiring these events fire in a specific order, we make a special “memory only” inflight object to prevent the race regardless of firing order.

Changelog-Fixed: Splice: bugfix for restart related race condition interacting with adversarial close detection.
@rustyrussell rustyrussell merged commit c67f1f9 into ElementsProject:master Aug 16, 2023
39 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.

errors after a restart after a successful splice
2 participants