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

wallet: keep height and txpos in sync in wallet.add_input_info()

Public commit record

What the developer wrote

Authored by Sander van Grieken

85/100 · Strong
wallet: keep height and txpos in sync in wallet.add_input_info()

a change in funding tx status (e.g. from verified to back in mempool due to reorg)
can change both height and txpos, but txpos was not kept in sync here. match
what adb.get_transaction() does.

also guard TxInput.short_id on both height and txpos
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a bookkeeping bug in the Electrum Bitcoin wallet. When a transaction's status changes due to a blockchain reorganization (for example, a confirmed transaction temporarily returns to the unconfirmed mempool), the wallet was updating a coin's 'block height' but forgetting to update its 'position within the block' (txpos). The two values were getting out of sync, which could make the wallet display or identify coins incorrectly. The fix keeps both values together and adds a safety check so the short display ID is only used when both height and position are valid.

Recommended action

Treat as a routine correctness fix. Review whether stale txpos could have led to incorrect coin selection, fee estimation, or user-visible transaction identification in edge cases involving reorgs. No immediate emergency response is indicated by the diff alone.

Security signals we found

01

State inconsistency between block_height and block_txpos after reorg or status transition

02

UI/model code relied on duplicated, weaker short_id validity check

03

Fix aligns add_input_info() behavior with adb.get_transaction()

04

No explicit vulnerability disclosure or CVE referenced in commit

Risk score

Why this scored 35/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 6/15
Affected reach 7/15
Confidence 6/10
Evidence quality 3/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.