Follow-up cleanups and clarifications after #35501 was merged.
Commit breakdown:
post-#35501 cleanup in
CWalletTx- Rename
arg_state→new_stateinUpdate()for consistency - Simplify
RecomputeCanonical()usingstd::ranges::min_elementwith a projection lambda (14 lines → 3 lines) - Add variant txid validation in the
CWalletTxdeserialise constructor: throwsstd::runtime_errorif any variant's txid doesn't match the canonical txid deserialized from the stream - Move
Init()toprivateand extend it to clearm_txsand resetm_canonical_wtxid, so a full re-deserialise viaUnserialize()starts from a clean state
All suggested by ajtowns.
- Rename
add unit test for variant txid validation in
CWalletTxdeserializerassert
listsinceblock"removed" reports current canonical wtxid Documents that removed entries reflect the wallet's currentCWalletTxstate, not a snapshot of the detached block. A future followup could improve this (requires per-block tracking of which witness variant was included). Suggested by w0xlt.clarify
alternate_wtxidsis empty when only one witness variant Suggested by polespinasa.