-
Notifications
You must be signed in to change notification settings - Fork 432
ElectrumSyncClient: Skip unconfirmed get_history entries
#4341
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
ElectrumSyncClient: Skip unconfirmed get_history entries
#4341
Conversation
|
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
TheBlueMatt
left a comment
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.
Would be kinda nice to have a test for this, but I'm okay with that just living in ldk-node
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4341 +/- ##
=======================================
Coverage 86.78% 86.79%
=======================================
Files 158 158
Lines 102788 102788
Branches 102788 102788
=======================================
+ Hits 89206 89210 +4
+ Misses 11236 11232 -4
Partials 2346 2346
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9f3970e to
ac0dba3
Compare
ac0dba3 to
115ab6d
Compare
Electrum's `blockchain.scripthash.get_history` will return the *confirmed* history for any scripthash, but will then also append any matching entries from the mempool, with respective `height` fields set to 0 or -1 (depending on whether all inputs are confirmed or not). Unfortunately we previously only included a filter for confirmed `get_history` entries in the watched output case, and forgot to add such a check also when checking for watched transactions. This would have us treat the entry as confirmed, then failing on the `get_merkle` step which of course couldn't prove block inclusion. Here we simply fix this omission and skip entries that are still unconfirmed (e.g., unconfirmed funding transactions from 0conf channels). Signed-off-by: Elias Rohrer <dev@tnull.de>
115ab6d to
cc1eb16
Compare
Electrum's
blockchain.scripthash.get_historywill return the confirmed history for any scripthash, but will then also append any matching entries from the mempool, with respectiveheightfields set to 0 or -1 (depending on whether all inputs are confirmed or not).Unfortunately we previously only included a filter for confirmed
get_historyentries in the watched output case, and forgot to add such a check also when checking for watched transactions. This would have us treat the entry as confirmed, then failing on theget_merklestep which of course couldn't prove block inclusion. Here we simply fix this omission and skip entries that are still unconfirmed (e.g., unconfirmed funding transactions from 0conf channels).