HomePhabricator

test: improve generation of conflicting transactions rpc_gettransactionstatus

Description

test: improve generation of conflicting transactions rpc_gettransactionstatus

Summary:
This test previously relied on the assumption that the transactions are padded with random data to create two different conflicting transactions. This is a bit fragile, as it would break if for some reason the transaction were already larger than 100 bytes and pad_tx didn't add random data.
Also I am going to need to make the MiniWallet generate deterministic transactions for assumeutxo testing, as we need to checkpoint a deterministic utxo dump. I plan to achieve this by allowing pad_tx to use non-random data for padding, which is another way to break this test.

So use the target_size parameter to explicitely make the transactions different, even if pad_tx adds non-random data. The tx size is arbitrary. I picked a value slightly larger than a standard P2PK transaction (168 bytes), to reduce the risks of pad_tx being a no-op if for any reason we change the wallet mode in the future to RAW_P2PK.

Depends on D17901

Test Plan:
ninja check-functional

Changed pad_tx to add deterministic data rather than random data, and checked that before this diff the test fails and after this diff it passes.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17902

Details

Provenance
PiRKAuthored on Sat, Apr 5, 15:25
PiRKPushed on Mon, Apr 7, 10:48
Reviewer
Restricted Project
Differential Revision
D17902: test: improve generation of conflicting transactions rpc_gettransactionstatus
Parents
rABC9492ec7874c5: test: don't pad_tx in MiniWallet.sign_tx
Branches
Unknown
Tags
Unknown