mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
fa5cbb8909uint256: Workaround GCC-14 stringop-overread bug in Compare (Ava Chow)6c9d76d589doc: release note for alternate_wtxids in gettransaction (Ava Chow)99bdcb064ctest: compat, ensure downgrade preserves tx witness variants (furszy)ef2afc6a0atest: Test for wallet txs with alternate wtxids (Ava Chow)2d55c7a74dwallet: Show alternate wtxids in gettransaction (Ava Chow)0b1af01bd4wallet: Replace CWalletTx::SetTx with Update (Ava Chow)56cf27db4dwallet: Store all witness variants of a transaction (furszy)798ba6d04fwallet: Make CWalletTx::tx private and use CWalletTx::GetTx to access (Ava Chow)72ebdd6364wallet: Remove unused CWalletTx CopyFrom and copy constructor (Ava Chow)19af439bdfwallet: Deserialize directly in CWalletTx's ctor (Ava Chow) Pull request description: When the wallet is presented with a transaction that has the same txid as one already known to the wallet, but has a different witness, instead of ignoring the transaction, store it alongside the known tx. This enables the wallet to be aware of all wtxid variants of its transactions. This also allows for the wallet to be able to calculate fees for replacements better as txs with different witnesses may have different feerates. Specifically, the wallet stores these alternates in `CWalletTx` and extends the existing `tx` record type to essentially have a vector of transactions appended to the record. In `CWalletTx`, the single transaction is replaced with a map of wtxid to transaction so that all witness variants can still be represented by a single `CWalletTx`. For all of the various things that need the tx from a `CWalletTx`, a single witness variant is chosen to be the canonical tx and returned by `GetTx()`. This canonical tx is written into the same place as the previous single tx was written to in the `tx` record so that wallets can be loaded into previous versions. To choose the canonical transaction, if any of the variants is confirmed, then that is the canonical one. Otherwise, the witness variant with the least weight is chosen. An additional change I've included is to make `CWalletTx` RAII. This simplifies some of the implementation and enforces the assumption that a `CWalletTx` always has a transaction. Lastly, `gettransaction` and `listtransaction` have a new field `alternate_wtxids` to inform users of the wtxids of the witness variants for a transaction, and of course, a test. Closes #11240 ACKs for top commit: furszy: ACKfa5cbb8909ajtowns: ACKfa5cbb8909w0xlt: ACKfa5cbb8909Tree-SHA512: ee303b395ab7a0843969f9491f876f4472c6301e968d9db87312edf44f7447245e707dd544356371d5f32fe6a619ee6937c24f3b7899f7a8108090b425f22d8e