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

Stop persisting background shutdown monitor updates #2287

Conversation

TheBlueMatt
Copy link
Collaborator

In d481008 we added logic to apply ChannelMonitorUpdates which
were a part of a channel closure async via a background queue to
address some startup issues. When we did that we persisted those
updates to ensure we replayed them when starting next time.

However, there was no reason to - if we persisted and then
restarted even without those monitor updates we'd find a monitor
without a channel, which we'd tell to broadcast the latest
commitment transaction to force-close.

Since adding that logic, we've used the same background queue for
several purposes.

Pointed out (indirectly) by @wpaulino at #2167 (comment)

In d481008 we added logic to apply `ChannelMonitorUpdate`s which
were a part of a channel closure async via a background queue to
address some startup issues. When we did that we persisted those
updates to ensure we replayed them when starting next time.

However, there was no reason to - if we persisted and then
restarted even without those monitor updates we'd find a monitor
without a channel, which we'd tell to broadcast the latest
commitment transaction to force-close.

Since adding that logic, we've used the same background queue for
several purposes.
This makes much clearer at sites generating such events that they
will be lost on restart, to reduce risk of bugs creeping in due to
lost monitor updates.
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 71.42% and project coverage change: -0.01 ⚠️

Comparison is base (f569e9f) 90.94% compared to head (5c090a2) 90.94%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2287      +/-   ##
==========================================
- Coverage   90.94%   90.94%   -0.01%     
==========================================
  Files         104      104              
  Lines       52760    52750      -10     
  Branches    52760    52750      -10     
==========================================
- Hits        47983    47971      -12     
- Misses       4777     4779       +2     
Impacted Files Coverage Δ
lightning/src/ln/channelmanager.rs 87.13% <71.42%> (-0.09%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

/// Handle a ChannelMonitorUpdate that closes a channel, broadcasting its current latest holder
/// commitment transaction.
ClosingMonitorUpdate((OutPoint, ChannelMonitorUpdate)),
/// Handle a ChannelMonitorUpdate
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
/// Handle a ChannelMonitorUpdate
/// Handle a ChannelMonitorUpdate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Twice? I can only fix it once, tho :)

@TheBlueMatt
Copy link
Collaborator Author

Will fix the missing . in #2167.

@TheBlueMatt TheBlueMatt merged commit 9e542ec into lightningdevkit:main May 10, 2023
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.

4 participants