Skip to content

Conversation

@tnull
Copy link
Contributor

@tnull tnull commented Jan 23, 2026

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).

@tnull tnull requested a review from TheBlueMatt January 23, 2026 13:55
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 23, 2026

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a 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

@ldk-reviews-bot
Copy link

👋 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
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.79%. Comparing base (feef6a4) to head (cc1eb16).
⚠️ Report is 9 commits behind head on main.

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           
Flag Coverage Δ
fuzzing 36.21% <ø> (ø)
tests 86.08% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tnull tnull force-pushed the 2026-01-electrum-improvements branch 2 times, most recently from 9f3970e to ac0dba3 Compare January 23, 2026 15:35
@tnull tnull requested a review from TheBlueMatt January 23, 2026 15:36
@tnull tnull force-pushed the 2026-01-electrum-improvements branch from ac0dba3 to 115ab6d Compare January 23, 2026 18:05
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>
@tnull tnull force-pushed the 2026-01-electrum-improvements branch from 115ab6d to cc1eb16 Compare January 23, 2026 18:08
@TheBlueMatt TheBlueMatt merged commit 1a50684 into lightningdevkit:main Jan 23, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants