test: ensure reason is checked for invalid blocks rejection
This commit is contained in:
1 parent
1a689a2c88
commit
8fcd684505
2 files changed
+6
No files matched your search
@@ -134,6 +134,8 @@ class BadInputOutpointIndex(BadTxTemplate):
|
|||||||
# Won't be rejected - nonexistent outpoint index is treated as an orphan since the coins
|
# 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.
|
# database can't distinguish between spent outpoints and outpoints which never existed.
|
||||||
reject_reason = None
|
reject_reason = None
|
||||||
|
# But fails in block
|
||||||
|
block_reject_reason = "bad-txns-inputs-missingorspent"
|
||||||
expect_disconnect = False
|
expect_disconnect = False
|
||||||
|
|
||||||
def get_tx(self):
|
def get_tx(self):
|
||||||
@@ -176,6 +178,8 @@ class PrevoutNullInput(BadTxTemplate):
|
|||||||
class NonexistentInput(BadTxTemplate):
|
class NonexistentInput(BadTxTemplate):
|
||||||
reject_reason = None # Added as an orphan tx.
|
reject_reason = None # Added as an orphan tx.
|
||||||
expect_disconnect = False
|
expect_disconnect = False
|
||||||
|
# But fails in block
|
||||||
|
block_reject_reason = "bad-txns-inputs-missingorspent"
|
||||||
|
|
||||||
def get_tx(self):
|
def get_tx(self):
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ class FullBlockTest(BitcoinTestFramework):
|
|||||||
if template.valid_in_block:
|
if template.valid_in_block:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
assert template.block_reject_reason or template.reject_reason
|
||||||
|
|
||||||
self.log.info(f"Reject block with invalid tx: {TxTemplate.__name__}")
|
self.log.info(f"Reject block with invalid tx: {TxTemplate.__name__}")
|
||||||
blockname = f"for_invalid.{TxTemplate.__name__}"
|
blockname = f"for_invalid.{TxTemplate.__name__}"
|
||||||
self.next_block(blockname)
|
self.next_block(blockname)
|
||||||
|
|||||||
Reference in new issue
Block a user