mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-28 06:54:19 +02:00
test: ensure reason is checked for invalid blocks rejection
This commit is contained in:
@@ -134,6 +134,8 @@ class BadInputOutpointIndex(BadTxTemplate):
|
||||
# Won't be rejected - nonexistent outpoint index is treated as an orphan since the coins
|
||||
# database can't distinguish between spent outpoints and outpoints which never existed.
|
||||
reject_reason = None
|
||||
# But fails in block
|
||||
block_reject_reason = "bad-txns-inputs-missingorspent"
|
||||
expect_disconnect = False
|
||||
|
||||
def get_tx(self):
|
||||
@@ -176,6 +178,8 @@ class PrevoutNullInput(BadTxTemplate):
|
||||
class NonexistentInput(BadTxTemplate):
|
||||
reject_reason = None # Added as an orphan tx.
|
||||
expect_disconnect = False
|
||||
# But fails in block
|
||||
block_reject_reason = "bad-txns-inputs-missingorspent"
|
||||
|
||||
def get_tx(self):
|
||||
tx = CTransaction()
|
||||
|
@@ -161,6 +161,8 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
if template.valid_in_block:
|
||||
continue
|
||||
|
||||
assert template.block_reject_reason or template.reject_reason
|
||||
|
||||
self.log.info(f"Reject block with invalid tx: {TxTemplate.__name__}")
|
||||
blockname = f"for_invalid.{TxTemplate.__name__}"
|
||||
self.next_block(blockname)
|
||||
|
Reference in New Issue
Block a user