File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,8 @@ class BadInputOutpointIndex(BadTxTemplate):
138
138
# Won't be rejected - nonexistent outpoint index is treated as an orphan since the coins
139
139
# database can't distinguish between spent outpoints and outpoints which never existed.
140
140
reject_reason = None
141
+ # But fails in block
142
+ block_reject_reason = "bad-txns-inputs-missingorspent"
141
143
expect_disconnect = False
142
144
143
145
def get_tx (self ):
@@ -180,6 +182,8 @@ def get_tx(self):
180
182
class NonexistentInput (BadTxTemplate ):
181
183
reject_reason = None # Added as an orphan tx.
182
184
expect_disconnect = False
185
+ # But fails in block
186
+ block_reject_reason = "bad-txns-inputs-missingorspent"
183
187
184
188
def get_tx (self ):
185
189
tx = CTransaction ()
@@ -229,7 +233,6 @@ def get_tx(self):
229
233
class InvalidOPIFConstruction (BadTxTemplate ):
230
234
reject_reason = "mandatory-script-verify-flag-failed (Invalid OP_IF construction)"
231
235
expect_disconnect = True
232
- valid_in_block = True
233
236
234
237
def get_tx (self ):
235
238
return create_tx_with_script (
@@ -278,7 +281,7 @@ def get_tx(self):
278
281
'reject_reason' : "disabled opcode" ,
279
282
'expect_disconnect' : True ,
280
283
'get_tx' : get_tx ,
281
- 'valid_in_block' : True
284
+ 'valid_in_block' : False
282
285
})
283
286
284
287
class NonStandardAndInvalid (BadTxTemplate ):
Original file line number Diff line number Diff line change @@ -153,9 +153,16 @@ def run_test(self):
153
153
for TxTemplate in invalid_txs .iter_all_templates ():
154
154
template = TxTemplate (spend_tx = attempt_spend_tx )
155
155
156
+ # belt-and-suspenders checking we won't pass up validating something
157
+ # we expect a disconnect from
158
+ if template .expect_disconnect :
159
+ assert not template .valid_in_block
160
+
156
161
if template .valid_in_block :
157
162
continue
158
163
164
+ assert template .block_reject_reason or template .reject_reason
165
+
159
166
self .log .info (f"Reject block with invalid tx: { TxTemplate .__name__ } " )
160
167
blockname = f"for_invalid.{ TxTemplate .__name__ } "
161
168
self .next_block (blockname )
You can’t perform that action at this time.
0 commit comments