-
Notifications
You must be signed in to change notification settings - Fork 402
Don't pause events for chainsync persistence #2957
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
Conversation
f674099
to
5ea38da
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2957 +/- ##
==========================================
+ Coverage 89.13% 89.35% +0.21%
==========================================
Files 118 118
Lines 97678 98933 +1255
Branches 97678 98933 +1255
==========================================
+ Hits 87066 88401 +1335
+ Misses 8370 8267 -103
- Partials 2242 2265 +23 ☔ View full report in Codecov by Sentry. |
I'm not sure if we document that assumption anywhere so far? Could you clarify if this would also pertain inbound payments and |
Synced offline, due to current event architecture, we could always get duplicate events after an event is handled and channel-manager isn't immediately persisted. |
Update: We no longer fail in release_pending_events for this, hence it should not be a concern anymore. |
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 change itself here looks good, but there's a ton of other changes in ChainMonitor
that we should unwind now. I'm pretty sure we can entirely drop UpdateOrigin
now (and just use the off-chain monitor update ID), stop tracking any pending monitor updates that came from on-chain, etc.
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.
Basically LGTM!
Needs rebase, also I think the top commit should be squashed down into the places that create the warnings. |
So one thing that came up while I was working with this API in the fuzzer is that its really awkward that the |
Discussed couple of things offline,
|
1d42927
to
e1d5921
Compare
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.
CI is failing and lots of docs are stale.
We used to wait on ChannelMonitor persistence to avoid duplicate payment events. But this can still happen in cases where ChannelMonitor handed the event to ChannelManager and we did not persist ChannelManager after event handling. It is expected to receive payment duplicate events and clients should handle these events in an idempotent manner. Removing this hold-up of events simplifies the logic and makes it easier to not persist ChannelMonitors on every block connect.
8a10e83
to
45de321
Compare
We only used to store last_chain_persist_height to release events held for more than LATENCY_GRACE_PERIOD_BLOCKS due to pending monitor update with UpdateOrigin::ChainSync. Since we no longer pause events for ChainSync persistence, we no longer need to store last_chain_persist_height.
We no longer need to track them since we no longer hold events for pending MonitorUpdates resulting from ChainSync.
b72e897
to
bd15c45
Compare
MonitorUpdateId was an opaque abstraction for id's generated by UpdateOrigin:Offchain and UpdateOrigin::ChainSync monitor updates. It was mainly needed to map calls made to ChainMonitor::channel_monitor_updated. We no longer track UpdateOrigin::ChainSync MonitorUpdates and can directly use ChannelMonitor::get_latest_update_id() for tracking UpdateOrigin::Offchain monitor updates.
It was used earlier for generating unique MonitorUpdateId for UpdateOrigin::ChainSync monitor updates.
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.
One comment that can be a followup.
Created a followup PR, I can merge that into this, if needed. |
This change was introduced in
5c2ff2cb30ef1639c80b275eea209a289dd91b77
(#1108)and the main reason mentioned is to avoid duplicate payment events.
Duplicate payment events should be expected by clients and handled in an idempotent manner.
Removing this holding up of events simplifies the logic and makes it easier to do #2647 in which we will stop persisting channelmonitors for every block update.
update_id
from public API of persist interface, i.e. bothpersist_new_channel
andupdate_persisted_channel
channel_monitor_updated
using monitor.getlatestUpdateId or update.update_id.update_persisted_channel