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

txbatcher: be careful when removing local transactions

Public commit record

What the developer wrote

Authored by ThomasV

85/100 · Strong
txbatcher: be careful when removing local transactions

1. Do not remove local transaction in find_base_tx.

This logic was intended to cleanup claim transactions that are
never broadcast (for example, if the counterparty gets a refund)
(see 1bf1de36cbbab3ef9bd06bf5009074f11f0d456d)

However, this code is too unspecific and may result in fund loss,
because the transaction being removed may contain outgoing payments.
For example, if the electrum server is not responsive, the tx will
be seen as local and deleted. In that case, another payment will
be attempted, thus paying twice.

2. Do not remove tx after try_broadcasting returns False.

The server might be lying to us. We can only remove the local tx
if there is a base_tx, because the next tx we create will try to
spend the same output.
✓ 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 bug in Electrum's transaction batching code that could accidentally delete a transaction that had already been sent to the Bitcoin network. If the Electrum server was slow, unresponsive, or dishonest, the wallet could think a payment was never broadcast, remove it from local records, and then create and send a second payment for the same thing—effectively paying twice and losing funds. The fix stops the wallet from automatically removing 'local' transactions in two risky situations and instead tries to rebroadcast them safely.

Recommended action

Users running Electrum versions with the txbatcher module (especially those using submarine swaps or batch payments) should upgrade to a version containing this commit. Operators should monitor for any unexpected duplicate outgoing payments and verify transaction history against the blockchain if they experienced unresponsive servers.

Security signals we found

01

Potential double-spend/double-payment due to premature local transaction removal

02

Server trust assumption: wallet relied on Electrum server height status to delete local transactions

03

Fund-loss condition when server is unresponsive or dishonest

04

Fix removes unsafe cleanup paths and replaces with rebroadcast logic

05

Test case validating unsafe behavior removed

Risk score

Why this scored 69/100

Our methodology →
Potential impact 22/30
Exploitability 15/25
Stealth signal 12/15
Affected reach 8/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.