Oh I see. This is due to passing the input even though it is not needed. What do you think about passing None in this case?
See this draft diff:
diff --git a/test/functional/feature_nulldummy.py b/test/functional/feature_nulldummy.py
index e860a7fc36..90e0887b08 100755
--- a/test/functional/feature_nulldummy.py
+++ b/test/functional/feature_nulldummy.py
@@ -60,19 +60,13 @@ class NULLDUMMYTest(BitcoinTestFramework):
'-par=1', # Use only one script thread to get the exact reject reason for testing
]]
- def create_transaction(self, *, txid, inAmount=None, spk=None, rs=None, ws=None, addr, amount, privkey):
+ def create_transaction(self, *, txid, prev_utxo_details=None, addr, amount, privkey):
input = {"txid": txid, "vout": 0}
- if inAmount is not None:
- input["amount"] = inAmount
- if spk is not None:
- input["scriptPubKey"] = spk
- if rs is not None:
- input["redeemScript"] = rs
- if ws is not None:
- input["witnessScript"] = ws
output = {addr: amount}
rawtx = self.nodes[0].createrawtransaction([input], output)
- signedtx = self.nodes[0].signrawtransactionwithkey(rawtx, [privkey], [input])
+ # Details only needed for scripthash or witness spends
+ input = None if not prev_utxo_details else [{**input,**prev_utxo_details}]
+ signedtx = self.nodes[0].signrawtransactionwithkey(rawtx, [privkey], input)
return tx_from_hex(signedtx["hex"])
def run_test(self):
@@ -101,24 +95,22 @@ class NULLDUMMYTest(BitcoinTestFramework):
self.log.info(f"Test 1: NULLDUMMY compliant base transactions should be accepted to mempool and mined before activation [{COINBASE_MATURITY + 3}]")
test1txs = [self.create_transaction(txid=coinbase_txid[0], addr=self.ms_address, amount=49,
- spk=self.nodes[0].getrawtransaction(coinbase_txid[0], True, block_hash[0])["vout"][0]["scriptPubKey"]["hex"],
privkey=self.nodes[0].PRIV_KEYS[0][1])]
txid1 = self.nodes[0].sendrawtransaction(test1txs[0].serialize_with_witness().hex(), 0)
spk = test1txs[0].vout[0].scriptPubKey.hex()
- test1txs.append(self.create_transaction(txid=txid1, spk=spk,
- rs=cms["redeemScript"],
+ test1txs.append(self.create_transaction(txid=txid1, prev_utxo_details={"scriptPubKey":spk,
+ "redeemScript":cms["redeemScript"]},
addr=self.ms_address, amount=48,
privkey=self.privkey))
txid2 = self.nodes[0].sendrawtransaction(test1txs[1].serialize_with_witness().hex(), 0)
test1txs.append(self.create_transaction(txid=coinbase_txid[1],
- spk=self.nodes[0].getrawtransaction(coinbase_txid[1], True, block_hash[1])["vout"][0]["scriptPubKey"]["hex"],
addr=self.wit_ms_address, amount=49,
privkey=self.nodes[0].PRIV_KEYS[0][1]))
txid3 = self.nodes[0].sendrawtransaction(test1txs[2].serialize_with_witness().hex(), 0)
self.block_submit(self.nodes[0], test1txs, accept=True)
self.log.info("Test 2: Non-NULLDUMMY base multisig transaction should not be accepted to mempool before activation")
- test2tx = self.create_transaction(txid=txid2, spk=spk, rs=cms["redeemScript"],
+ test2tx = self.create_transaction(txid=txid2, prev_utxo_details={"scriptPubKey":spk, "redeemScript":cms["redeemScript"]},
addr=self.ms_address, amount=47,
privkey=self.privkey)
invalidate_nulldummy_tx(test2tx)
@@ -128,7 +120,7 @@ class NULLDUMMYTest(BitcoinTestFramework):
self.block_submit(self.nodes[0], [test2tx], accept=True)
self.log.info("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
- test4tx = self.create_transaction(txid=test2tx.hash, spk=spk, rs=cms["redeemScript"],
+ test4tx = self.create_transaction(txid=test2tx.hash, prev_utxo_details={"scriptPubKey":spk, "redeemScript":cms["redeemScript"]},
addr=self.address, amount=46,
privkey=self.privkey)
test6txs = [CTransaction(test4tx)]
@@ -137,8 +129,8 @@ class NULLDUMMYTest(BitcoinTestFramework):
self.block_submit(self.nodes[0], [test4tx], accept=False)
self.log.info("Test 5: Non-NULLDUMMY P2WSH multisig transaction invalid after activation")
- test5tx = self.create_transaction(txid=txid3, spk=test1txs[2].vout[0].scriptPubKey.hex(),
- inAmount=49, ws=wms["redeemScript"],
+ test5tx = self.create_transaction(txid=txid3, prev_utxo_details={"scriptPubKey":test1txs[2].vout[0].scriptPubKey.hex(),
+ "amount":49, "witnessScript":wms["redeemScript"]},
addr=self.wit_address, amount=48,
privkey=self.privkey)
test6txs.append(CTransaction(test5tx))