mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
4ca182ca40doc: clarify alternate_wtxids is empty when only one witness variant (pablomartin4btc)fa48b5d28etest: assert listsinceblock "removed" reports current canonical wtxid (pablomartin4btc)9b96ee1288wallet, test: add unit test for variant txid validation in CWalletTx deserializer (pablomartin4btc)9de6543cb5wallet: post-#35501 cleanup in CWalletTx (pablomartin4btc) Pull request description: Follow-up cleanups and clarifications after #35501 was merged. Commit breakdown: 1. _post-[#35501](https://github.com/bitcoin/bitcoin/pull/35501) cleanup in_ `CWalletTx` - Rename `arg_state` → `new_state` in `Update()` for consistency - Simplify `RecomputeCanonical()` using `std::ranges::min_element` with a projection lambda (14 lines → 3 lines) - Add variant txid validation in the `CWalletTx` deserialise constructor: throws `std::runtime_error` if any variant's txid doesn't match the canonical txid deserialized from the stream - Move `Init()` to `private` and extend it to clear `m_txs` and reset `m_canonical_wtxid`, so a full re-deserialise via `Unserialize()` starts from a clean state All [suggested](https://github.com/bitcoin/bitcoin/pull/35501#pullrequestreview-4854519083) by ajtowns. 2. _add unit test for variant txid validation in_ `CWalletTx` _deserializer_ 3. _assert_ `listsinceblock` "removed" _reports current canonical wtxid_ Documents that removed entries reflect the wallet's current `CWalletTx` state, not a snapshot of the detached block. A future followup could improve this (requires per-block tracking of which witness variant was included). [Suggested](https://github.com/bitcoin/bitcoin/pull/35501#discussion_r3632044472) by w0xlt. 4. _clarify_ `alternate_wtxids` _is empty when only one witness variant_ [Suggested](https://github.com/bitcoin/bitcoin/pull/35501#discussion_r3632113003) by polespinasa. ACKs for top commit: jeanpablojp: re-ACK4ca182ca40achow101: ACK4ca182ca40polespinasa: ACK4ca182ca40Tree-SHA512: 64eadeb11372d904c79edbfd264c4d8dc1b4fe4ce5e3acc301bfeba9e556efb5dce2c684f0e58c7b74e2c687cc7dd77389970662b3fd629ed034a97bcfdfb71c