-
Notifications
You must be signed in to change notification settings - Fork 371
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
lightning-block-sync
: Fix synchronize_listeners
always calling default implementation
#3354
lightning-block-sync
: Fix synchronize_listeners
always calling default implementation
#3354
Conversation
Previously, the `ChainListenerSet` `Listen` implementation wouldn't forward to the listeners `block_connected` implementation outside of tests. This would result in the default implementation of `Listen::block_connected` being used and the listeners implementation never being called.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3354 +/- ##
==========================================
- Coverage 89.61% 89.61% -0.01%
==========================================
Files 127 127
Lines 103531 103531
Branches 103531 103531
==========================================
- Hits 92782 92779 -3
+ Misses 8052 8048 -4
- Partials 2697 2704 +7 ☔ View full report in Codecov by Sentry. |
// Needed to differentiate test expectations. | ||
#[cfg(test)] |
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.
It looks like it was calling each listener's filtered_block_connected
method, though, instead of block_connected
. Is that a problem? Not clear from the commit message why.
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.
As also discussed offline, the issue here is that the overridden Listen::block_connected
implementation would never be called for the listeners. I.e., if they implement some behavior diverging from the default implementation, it would never be used which is clearly a bug.
If we don't expect users to override block_connected
, it shouldn't be a trait method in the first place, IMO. Although I really think we should allow it (as we'll now also require it for LDK Node onchain wallet's listener).
We previously discovered a minor bug that resulted in `synchronize_listeners` not calling the actual implementation of `Listen::block_connected`. While we will fix this upstream (lightningdevkit/rust-lightning#3354), we now copy over the fixed code in question to not be blocked on the next LDK release. We also slightly adjusted it to account for types/APIs that are only visible inside of `lightning-block-sync`. We intend to drop the newly added module as soon as we can upgrade to the next LDK release shipping the fixed version.
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.
LGMT
Previously, the
ChainListenerSet
Listen
implementation wouldn't forward to the listenersblock_connected
implementation outside of tests. This would result in the default implementation ofListen::block_connected
being used and the listeners implementation never being called.