AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 49 Bitcoin

`ElectrumSyncClient`: Skip unconfirmed `get_history` entries

Public commit record

What the developer wrote

Authored by Elias Rohrer

73/100 · Adequate
`ElectrumSyncClient`: Skip unconfirmed `get_history` entries

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>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This patch fixes a bug in rust-lightning's Electrum-based transaction sync. When checking whether watched transactions were confirmed, the code previously treated unconfirmed mempool entries from Electrum's get_history as if they were already confirmed. It would then try to fetch a Merkle proof of block inclusion, which cannot exist for an unconfirmed transaction, causing a failure. The fix skips any history entry whose height is 0 or -1 (unconfirmed) in the watched-transaction path, matching what was already done for watched outputs. A debug assertion was also replaced with a proper error log and return if a server returns duplicate history entries.

Recommended action

Apply the patch. Users relying on ElectrumSyncClient should upgrade to avoid spurious sync failures when watched transactions are still unconfirmed (e.g., 0conf channel funding). No immediate key-rotation or emergency response is indicated; this is a robustness fix rather than a key-compromise vulnerability.

Security signals we found

01

Denial-of-service via unconfirmed transaction handling: a malicious or buggy Electrum server, or simply mempool state, could return unconfirmed history entries that caused local sync failure.

02

Incorrect confirmation state assumption: mempool entries were processed as confirmed, leading to impossible get_merkle requests.

03

Inconsistent filtering between watched outputs and watched transactions paths.

04

Replacement of debug-only assertion with runtime error handling for duplicate history entries.

Risk score

Why this scored 49/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 7/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.