Skip to content

Commit 8fcd684

Browse files
committed
test: ensure reason is checked for invalid blocks rejection
1 parent 1a689a2 commit 8fcd684

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/functional/data/invalid_txs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ class BadInputOutpointIndex(BadTxTemplate):
134134
# Won't be rejected - nonexistent outpoint index is treated as an orphan since the coins
135135
# database can't distinguish between spent outpoints and outpoints which never existed.
136136
reject_reason = None
137+
# But fails in block
138+
block_reject_reason = "bad-txns-inputs-missingorspent"
137139
expect_disconnect = False
138140

139141
def get_tx(self):
@@ -176,6 +178,8 @@ def get_tx(self):
176178
class NonexistentInput(BadTxTemplate):
177179
reject_reason = None # Added as an orphan tx.
178180
expect_disconnect = False
181+
# But fails in block
182+
block_reject_reason = "bad-txns-inputs-missingorspent"
179183

180184
def get_tx(self):
181185
tx = CTransaction()

test/functional/feature_block.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ def run_test(self):
161161
if template.valid_in_block:
162162
continue
163163

164+
assert template.block_reject_reason or template.reject_reason
165+
164166
self.log.info(f"Reject block with invalid tx: {TxTemplate.__name__}")
165167
blockname = f"for_invalid.{TxTemplate.__name__}"
166168
self.next_block(blockname)

0 commit comments

Comments
 (0)