0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

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.
This commit is contained in:
Sebastian Falbesoner 2021-07-05 22:49:52 +02:00
parent 2711559845
commit aa0a5bb70d

View file

@ -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