mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
test: assert listsinceblock "removed" reports current canonical wtxid
When a block is detached, listsinceblock "removed" entries reflect the wallet's current CWalletTx rather than a snapshot of the variant that was actually in the detached block. Add assertions to make this behaviour explicit. A future followup could improve listsinceblock to track and report the specific witness variant that was in the disconnected block (requires per-block tracking of which witness variant was included). Co-authored-by: w0xlt <94266259+w0xlt@users.noreply.github.com>
This commit is contained in:
@@ -356,6 +356,16 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
assert_equal(wallet.gettransaction(txid)["confirmations"], 0)
|
||||
self.check_tx_variants(wallet, txid, key_path_tx, key_path_wtxid, alternate_wtxids=[script_path_wtxid])
|
||||
|
||||
# listsinceblock "removed" entries reflect the wallet's current CWalletTx, not a
|
||||
# snapshot of the detached block. The detached block contained the heavier script
|
||||
# path variant, but "wtxid" reports the current canonical (key path) variant and
|
||||
# the script path variant appears under "alternate_wtxids". A future improvement
|
||||
# could track which specific variant was in the detached block and report that.
|
||||
removed = next(e for e in wallet.listsinceblock(block)["removed"] if e["txid"] == txid)
|
||||
assert_equal(removed["confirmations"], 0)
|
||||
assert_equal(removed["wtxid"], key_path_wtxid)
|
||||
assert_equal(removed["alternate_wtxids"], [script_path_wtxid])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ListTransactionsTest(__file__).main()
|
||||
|
||||
Reference in New Issue
Block a user