@@ -42,7 +42,11 @@ class RawTransactionsTest(BitcoinTestFramework):
42
42
def set_test_params (self ):
43
43
self .setup_clean_chain = True
44
44
self .num_nodes = 3
45
- self .extra_args = [["-addresstype=legacy" , "-txindex" ], ["-addresstype=legacy" , "-txindex" ], ["-addresstype=legacy" , "-txindex" ]]
45
+ self .extra_args = [
46
+ ["-txindex" ],
47
+ ["-txindex" ],
48
+ ["-txindex" ],
49
+ ]
46
50
47
51
def skip_test_if_missing_module (self ):
48
52
self .skip_if_no_wallet ()
@@ -361,30 +365,30 @@ def run_test(self):
361
365
362
366
# getrawtransaction tests
363
367
# 1. valid parameters - only supply txid
364
- txHash = rawTx ["hash " ]
365
- assert_equal (self .nodes [0 ].getrawtransaction (txHash ), rawTxSigned ['hex' ])
368
+ txId = rawTx ["txid " ]
369
+ assert_equal (self .nodes [0 ].getrawtransaction (txId ), rawTxSigned ['hex' ])
366
370
367
371
# 2. valid parameters - supply txid and 0 for non-verbose
368
- assert_equal (self .nodes [0 ].getrawtransaction (txHash , 0 ), rawTxSigned ['hex' ])
372
+ assert_equal (self .nodes [0 ].getrawtransaction (txId , 0 ), rawTxSigned ['hex' ])
369
373
370
374
# 3. valid parameters - supply txid and False for non-verbose
371
- assert_equal (self .nodes [0 ].getrawtransaction (txHash , False ), rawTxSigned ['hex' ])
375
+ assert_equal (self .nodes [0 ].getrawtransaction (txId , False ), rawTxSigned ['hex' ])
372
376
373
377
# 4. valid parameters - supply txid and 1 for verbose.
374
378
# We only check the "hex" field of the output so we don't need to update this test every time the output format changes.
375
- assert_equal (self .nodes [0 ].getrawtransaction (txHash , 1 )["hex" ], rawTxSigned ['hex' ])
379
+ assert_equal (self .nodes [0 ].getrawtransaction (txId , 1 )["hex" ], rawTxSigned ['hex' ])
376
380
377
381
# 5. valid parameters - supply txid and True for non-verbose
378
- assert_equal (self .nodes [0 ].getrawtransaction (txHash , True )["hex" ], rawTxSigned ['hex' ])
382
+ assert_equal (self .nodes [0 ].getrawtransaction (txId , True )["hex" ], rawTxSigned ['hex' ])
379
383
380
384
# 6. invalid parameters - supply txid and string "Flase"
381
- assert_raises_rpc_error (- 1 , "not a boolean" , self .nodes [0 ].getrawtransaction , txHash , "Flase" )
385
+ assert_raises_rpc_error (- 1 , "not a boolean" , self .nodes [0 ].getrawtransaction , txId , "Flase" )
382
386
383
387
# 7. invalid parameters - supply txid and empty array
384
- assert_raises_rpc_error (- 1 , "not a boolean" , self .nodes [0 ].getrawtransaction , txHash , [])
388
+ assert_raises_rpc_error (- 1 , "not a boolean" , self .nodes [0 ].getrawtransaction , txId , [])
385
389
386
390
# 8. invalid parameters - supply txid and empty dict
387
- assert_raises_rpc_error (- 1 , "not a boolean" , self .nodes [0 ].getrawtransaction , txHash , {})
391
+ assert_raises_rpc_error (- 1 , "not a boolean" , self .nodes [0 ].getrawtransaction , txId , {})
388
392
389
393
inputs = [ {'txid' : "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000" , 'vout' : 1 , 'sequence' : 1000 }]
390
394
outputs = { self .nodes [0 ].getnewaddress () : 1 }
@@ -438,17 +442,17 @@ def run_test(self):
438
442
rawTx = self .nodes [2 ].createrawtransaction (inputs , outputs )
439
443
rawTxSigned = self .nodes [2 ].signrawtransactionwithwallet (rawTx )
440
444
assert_equal (rawTxSigned ['complete' ], True )
441
- # 1000 sat fee, ~200 b transaction, fee rate should land around 5 sat/b = 0.00005000 BTC/kB
445
+ # 1000 sat fee, ~100 b transaction, fee rate should land around 10 sat/b = 0.00010000 BTC/kB
442
446
# Thus, testmempoolaccept should reject
443
447
testres = self .nodes [2 ].testmempoolaccept ([rawTxSigned ['hex' ]], 0.00001000 )[0 ]
444
448
assert_equal (testres ['allowed' ], False )
445
449
assert_equal (testres ['reject-reason' ], '256: absurdly-high-fee' )
446
450
# and sendrawtransaction should throw
447
451
assert_raises_rpc_error (- 26 , "absurdly-high-fee" , self .nodes [2 ].sendrawtransaction , rawTxSigned ['hex' ], 0.00001000 )
448
452
# And below calls should both succeed
449
- testres = self .nodes [2 ].testmempoolaccept (rawtxs = [rawTxSigned ['hex' ]], maxfeerate = '0.00007000 ' )[0 ]
453
+ testres = self .nodes [2 ].testmempoolaccept (rawtxs = [rawTxSigned ['hex' ]], maxfeerate = '0.00070000 ' )[0 ]
450
454
assert_equal (testres ['allowed' ], True )
451
- self .nodes [2 ].sendrawtransaction (hexstring = rawTxSigned ['hex' ], maxfeerate = '0.00007000 ' )
455
+ self .nodes [2 ].sendrawtransaction (hexstring = rawTxSigned ['hex' ], maxfeerate = '0.00070000 ' )
452
456
453
457
454
458
if __name__ == '__main__' :
0 commit comments