@@ -71,7 +71,7 @@ def run_test(self):
71
71
node .generate (1 )
72
72
self .mempool_size = 0
73
73
self .check_mempool_result (
74
- result_expected = [{'txid' : txid_in_block , 'allowed' : False , 'reject-reason' : '18: txn-already-known' }],
74
+ result_expected = [{'txid' : txid_in_block , 'allowed' : False , 'reject-reason' : 'txn-already-known' }],
75
75
rawtxs = [raw_tx_in_block ],
76
76
)
77
77
@@ -109,7 +109,7 @@ def run_test(self):
109
109
node .sendrawtransaction (hexstring = raw_tx_0 )
110
110
self .mempool_size += 1
111
111
self .check_mempool_result (
112
- result_expected = [{'txid' : txid_0 , 'allowed' : False , 'reject-reason' : '18: txn-already-in-mempool' }],
112
+ result_expected = [{'txid' : txid_0 , 'allowed' : False , 'reject-reason' : 'txn-already-in-mempool' }],
113
113
rawtxs = [raw_tx_0 ],
114
114
)
115
115
@@ -133,7 +133,7 @@ def run_test(self):
133
133
tx .vout [0 ].nValue -= int (4 * fee * COIN ) # Set more fee
134
134
# skip re-signing the tx
135
135
self .check_mempool_result (
136
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '18: txn-mempool-conflict' }],
136
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'txn-mempool-conflict' }],
137
137
rawtxs = [tx .serialize ().hex ()],
138
138
maxfeerate = 0 ,
139
139
)
@@ -192,23 +192,23 @@ def run_test(self):
192
192
# Skip re-signing the transaction for context independent checks from now on
193
193
# tx.deserialize(BytesIO(hex_str_to_bytes(node.signrawtransactionwithwallet(tx.serialize().hex())['hex'])))
194
194
self .check_mempool_result (
195
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: bad-txns-vout-empty' }],
195
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'bad-txns-vout-empty' }],
196
196
rawtxs = [tx .serialize ().hex ()],
197
197
)
198
198
199
199
self .log .info ('A really large transaction' )
200
200
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
201
201
tx .vin = [tx .vin [0 ]] * math .ceil (MAX_BLOCK_BASE_SIZE / len (tx .vin [0 ].serialize ()))
202
202
self .check_mempool_result (
203
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: bad-txns-oversize' }],
203
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'bad-txns-oversize' }],
204
204
rawtxs = [tx .serialize ().hex ()],
205
205
)
206
206
207
207
self .log .info ('A transaction with negative output value' )
208
208
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
209
209
tx .vout [0 ].nValue *= - 1
210
210
self .check_mempool_result (
211
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: bad-txns-vout-negative' }],
211
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'bad-txns-vout-negative' }],
212
212
rawtxs = [tx .serialize ().hex ()],
213
213
)
214
214
@@ -217,7 +217,7 @@ def run_test(self):
217
217
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
218
218
tx .vout [0 ].nValue = 21000000 * COIN + 1
219
219
self .check_mempool_result (
220
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: bad-txns-vout-toolarge' }],
220
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'bad-txns-vout-toolarge' }],
221
221
rawtxs = [tx .serialize ().hex ()],
222
222
)
223
223
@@ -226,15 +226,15 @@ def run_test(self):
226
226
tx .vout = [tx .vout [0 ]] * 2
227
227
tx .vout [0 ].nValue = 21000000 * COIN
228
228
self .check_mempool_result (
229
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: bad-txns-txouttotal-toolarge' }],
229
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'bad-txns-txouttotal-toolarge' }],
230
230
rawtxs = [tx .serialize ().hex ()],
231
231
)
232
232
233
233
self .log .info ('A transaction with duplicate inputs' )
234
234
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
235
235
tx .vin = [tx .vin [0 ]] * 2
236
236
self .check_mempool_result (
237
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: bad-txns-inputs-duplicate' }],
237
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'bad-txns-inputs-duplicate' }],
238
238
rawtxs = [tx .serialize ().hex ()],
239
239
)
240
240
@@ -243,49 +243,49 @@ def run_test(self):
243
243
raw_tx_coinbase_spent = node .getrawtransaction (txid = node .decoderawtransaction (hexstring = raw_tx_in_block )['vin' ][0 ]['txid' ])
244
244
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_coinbase_spent )))
245
245
self .check_mempool_result (
246
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '16: coinbase' }],
246
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'coinbase' }],
247
247
rawtxs = [tx .serialize ().hex ()],
248
248
)
249
249
250
250
self .log .info ('Some nonstandard transactions' )
251
251
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
252
252
tx .nVersion = 3 # A version currently non-standard
253
253
self .check_mempool_result (
254
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: version' }],
254
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'version' }],
255
255
rawtxs = [tx .serialize ().hex ()],
256
256
)
257
257
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
258
258
tx .vout [0 ].scriptPubKey = CScript ([OP_0 ]) # Some non-standard script
259
259
self .check_mempool_result (
260
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: scriptpubkey' }],
260
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'scriptpubkey' }],
261
261
rawtxs = [tx .serialize ().hex ()],
262
262
)
263
263
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
264
264
tx .vin [0 ].scriptSig = CScript ([OP_HASH160 ]) # Some not-pushonly scriptSig
265
265
self .check_mempool_result (
266
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: scriptsig-not-pushonly' }],
266
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'scriptsig-not-pushonly' }],
267
267
rawtxs = [tx .serialize ().hex ()],
268
268
)
269
269
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
270
270
output_p2sh_burn = CTxOut (nValue = 540 , scriptPubKey = CScript ([OP_HASH160 , hash160 (b'burn' ), OP_EQUAL ]))
271
271
num_scripts = 100000 // len (output_p2sh_burn .serialize ()) # Use enough outputs to make the tx too large for our policy
272
272
tx .vout = [output_p2sh_burn ] * num_scripts
273
273
self .check_mempool_result (
274
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: tx-size' }],
274
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'tx-size' }],
275
275
rawtxs = [tx .serialize ().hex ()],
276
276
)
277
277
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
278
278
tx .vout [0 ] = output_p2sh_burn
279
279
tx .vout [0 ].nValue -= 1 # Make output smaller, such that it is dust for our policy
280
280
self .check_mempool_result (
281
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: dust' }],
281
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'dust' }],
282
282
rawtxs = [tx .serialize ().hex ()],
283
283
)
284
284
tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_reference )))
285
285
tx .vout [0 ].scriptPubKey = CScript ([OP_RETURN , b'\xff ' ])
286
286
tx .vout = [tx .vout [0 ]] * 2
287
287
self .check_mempool_result (
288
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: multi-op-return' }],
288
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'multi-op-return' }],
289
289
rawtxs = [tx .serialize ().hex ()],
290
290
)
291
291
@@ -294,7 +294,7 @@ def run_test(self):
294
294
tx .vin [0 ].nSequence -= 1 # Should be non-max, so locktime is not ignored
295
295
tx .nLockTime = node .getblockcount () + 1
296
296
self .check_mempool_result (
297
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: non-final' }],
297
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'non-final' }],
298
298
rawtxs = [tx .serialize ().hex ()],
299
299
)
300
300
@@ -303,7 +303,7 @@ def run_test(self):
303
303
tx .vin [0 ].nSequence = 2 # We could include it in the second block mined from now, but not the very next one
304
304
# Can skip re-signing the tx because of early rejection
305
305
self .check_mempool_result (
306
- result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : '64: non-BIP68-final' }],
306
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : False , 'reject-reason' : 'non-BIP68-final' }],
307
307
rawtxs = [tx .serialize ().hex ()],
308
308
maxfeerate = 0 ,
309
309
)
0 commit comments