From aa0a5bb70d77739d43d5a9ceae78fb0c6fafd435 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Mon, 5 Jul 2021 22:49:52 +0200 Subject: [PATCH] test: add `bad-txns-prevout-null` test case to invalid_txs.py This reject reason is triggered for non-coinbase transactions with a coinbase-like outpoint, i.e. hash=0, n=0xffffffff. Note that the invalid tx templates are currently used in the functional tests feature_block.py and p2p_invalid_tx.py. --- test/functional/data/invalid_txs.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/functional/data/invalid_txs.py b/test/functional/data/invalid_txs.py index fab921ef193..95c7370995f 100644 --- a/test/functional/data/invalid_txs.py +++ b/test/functional/data/invalid_txs.py @@ -151,6 +151,19 @@ class DuplicateInput(BadTxTemplate): return tx +class PrevoutNullInput(BadTxTemplate): + reject_reason = 'bad-txns-prevout-null' + expect_disconnect = True + + def get_tx(self): + tx = CTransaction() + tx.vin.append(self.valid_txin) + tx.vin.append(CTxIn(COutPoint(hash=0, n=0xffffffff))) + tx.vout.append(CTxOut(1, basic_p2sh)) + tx.calc_sha256() + return tx + + class NonexistentInput(BadTxTemplate): reject_reason = None # Added as an orphan tx. expect_disconnect = False