mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 21:52:53 +02:00
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.
8.8 KiB
8.8 KiB