-
Notifications
You must be signed in to change notification settings - Fork 411
Persist entire monitor if there is an error while applying monitor_update #2621
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
Persist entire monitor if there is an error while applying monitor_update #2621
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2621 +/- ##
==========================================
+ Coverage 88.96% 89.00% +0.03%
==========================================
Files 112 112
Lines 86337 86642 +305
Branches 86337 86642 +305
==========================================
+ Hits 76812 77113 +301
- Misses 7289 7290 +1
- Partials 2236 2239 +3
☔ View full report in Codecov by Sentry. |
Marking this review ready, will squash on request (and add PR description to commit msgs.) |
Yes, feel free to squash IMO. This patch has very little risk, so I think we shouldn't worry too much about landing it. Please also update the documentation on |
Will be squashing. |
0c9274b
to
8119244
Compare
Please swap the test_utils changes for the first so that the first commit doesn't break tests. |
Otherwise LGTM. |
8119244
to
0f94992
Compare
CI is not happy:
|
// still be changed. Therefore, we should persist the updated monitor despite the error. | ||
// We don't want to persist a `monitor_update` which results in a failure to apply later | ||
// while reading `channel_monitor` with updates from storage. Instead, we should persist | ||
// the entire `channel_monitor` here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can make this "Instead, we should persist the entire channel_monitor
here, otherwise we will fail to initialize this monitor during restart."
But wasn't sure if it adds more confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous sentence makes that clear imo.
d7b50bf
to
bfcb6ff
Compare
We were incorrectly marking updates as chain_sync or not in test_utils based on whether monitor_update is None or not. Instead, use UpdateOrigin to determine it.
Motivation: When there is an error while applying monitor_update to a channel_monitor, we don't want to persist a 'monitor_update' which results in a failure to apply later while reading 'channel_monitor' with updates from storage. Instead, we should persist the entire 'channel_monitor' here.
bfcb6ff
to
976acd8
Compare
Commit 1: Correctly mark chain_sync updates in test_utils
We were incorrectly marking updates as chain_sync
or not in test_utils based on whether monitor_update
is None or not. Instead, use UpdateOrigin to determine it.
Commit 2: Persist full monitor if there is an error while applying monitor_update
Motivation: When there is an error while applying monitor_update to a
channel_monitor, we don't want to persist a 'monitor_update' which
results in a failure to apply later while reading 'channel_monitor' with
updates from storage. Instead, we should persist the entire 'channel_monitor'
here, otherwise we might be stuck in unrecoverable state after restart.
// TODO: Write test-cases for this change.