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

wallet: Store all witness variants of a transaction

Public commit record

What the developer wrote

Authored by furszy

85/100 · Strong
wallet: Store all witness variants of a transaction

A transaction can have several valid witnesses that share its txid but
differ in wtxid, e.g. when a taproot output is spent via the key path
in one variant and the script path in another.

CWalletTx now keeps all of them in a map indexed by wtxid (m_txs) and
marks one as canonical (m_canonical_wtxid): a confirmed variant if there
is one, otherwise the one with a witness and the lowest weight. GetTx()
and serialization return the canonical variant, so existing callers
don't need to change.

The other variants are stored in their own wtxvariant records keyed by
(txid, wtxid) and merged back into the CWalletTx at load. The tx record
keeps its old format, holding the canonical transaction, so older soft
versions can still read and rewrite it without dropping those records.
✓ 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 Bitcoin Core wallet change lets the wallet remember multiple valid versions of the same transaction that look identical on-chain by transaction ID (txid) but differ by witness transaction ID (wtxid). For example, a Taproot spend can be signed in two different valid ways. Previously the wallet only kept one witness version, which could cause it to lose track of the actual confirmed version or show wrong balances/labels. The fix stores all variants and picks a canonical one, with older wallet software still able to read the main record safely.

Recommended action

Treat as a wallet correctness/data-integrity improvement rather than an active exploit. Reviewers should verify that canonical selection cannot be manipulated by an attacker-supplied variant, that ErasePrefix correctly removes all wtxvariant records, and that downgrade/upgrade scenarios do not leave orphaned or inconsistent records. No urgent patch deployment is indicated absent a disclosed vulnerability.

Security signals we found

01

Data integrity / consistency fix for wallet transaction state

02

Taproot witness malleability handling

03

Database schema addition (wtxvariant records) with backward-compatible canonical tx record

04

Potential balance/reporting correctness issue if wrong witness variant is treated as canonical

05

No explicit bugfix CVE or security disclosure in commit message

Risk score

Why this scored 35/100

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