test: cover BIP30 for non coinbase txs

bitcoin/bitcoin: PR #36847

1 suggestion

Optional improvements

Link

[suggestion] · The non-coinbase BIP30 test misses partially spent transactions

Like the existing coinbase cases, the new single-output fixture cannot distinguish checking every output from checking only output 0, leaving the partially spent BIP30 case uncovered.

Location: test/functional/feature_block.py:876 (head).

Details and suggested fix

dup_cb_spend_tx (A) has one output. The first replay is rejected while A:0 is unspent, and the successful replay follows create_and_sign_transaction, which spends A:0. A BIP30 regression checking only output 0 would preserve both assertions, even though ConnectBlock must check every output. Add a second zero-value OP_TRUE output to A. After the duplicate coinbase matures, spend only A:0 and assert that replaying A still fails with bad-txns-BIP30. Then spend A:1, using create_tx(dup_cb_spend_tx, 1, 0) and sign_tx, before checking that replay succeeds. This adds a distinct partially spent state while preserving the earlier coinbase allow-if-spent case and coverage of the PR's coinbase-only mutant.


Coverage details