@@ -438,48 +438,50 @@ def run_test(self):
438
438
439
439
self .log .info ('sendrawtransaction/testmempoolaccept with maxfeerate' )
440
440
441
- # Test a transaction with small fee
441
+ # Test a transaction with a small fee.
442
442
txId = self .nodes [0 ].sendtoaddress (self .nodes [2 ].getnewaddress (), 1.0 )
443
443
rawTx = self .nodes [0 ].getrawtransaction (txId , True )
444
444
vout = next (o for o in rawTx ['vout' ] if o ['value' ] == Decimal ('1.00000000' ))
445
445
446
446
self .sync_all ()
447
447
inputs = [{ "txid" : txId , "vout" : vout ['n' ] }]
448
- outputs = { self .nodes [0 ].getnewaddress () : Decimal ("0.99990000" ) } # 10000 sat fee
448
+ # Fee 10,000 satoshis, (1 - (10000 sat * 0.00000001 BTC/sat)) = 0.9999
449
+ outputs = { self .nodes [0 ].getnewaddress () : Decimal ("0.99990000" ) }
449
450
rawTx = self .nodes [2 ].createrawtransaction (inputs , outputs )
450
451
rawTxSigned = self .nodes [2 ].signrawtransactionwithwallet (rawTx )
451
452
assert_equal (rawTxSigned ['complete' ], True )
452
- # 10000 sat fee , ~100 b transaction, fee rate should land around 100 sat/b = 0.00100000 BTC/kB
453
+ # Fee 10,000 satoshis , ~100 b transaction, fee rate should land around 100 sat/byte = 0.00100000 BTC/kB
453
454
# Thus, testmempoolaccept should reject
454
455
testres = self .nodes [2 ].testmempoolaccept ([rawTxSigned ['hex' ]], 0.00001000 )[0 ]
455
456
assert_equal (testres ['allowed' ], False )
456
457
assert_equal (testres ['reject-reason' ], '256: absurdly-high-fee' )
457
458
# and sendrawtransaction should throw
458
459
assert_raises_rpc_error (- 26 , "absurdly-high-fee" , self .nodes [2 ].sendrawtransaction , rawTxSigned ['hex' ], 0.00001000 )
459
- # And below calls should both succeed
460
+ # and the following calls should both succeed
460
461
testres = self .nodes [2 ].testmempoolaccept (rawtxs = [rawTxSigned ['hex' ]])[0 ]
461
462
assert_equal (testres ['allowed' ], True )
462
463
self .nodes [2 ].sendrawtransaction (hexstring = rawTxSigned ['hex' ])
463
464
464
- # Test a transaction with large fee
465
+ # Test a transaction with a large fee.
465
466
txId = self .nodes [0 ].sendtoaddress (self .nodes [2 ].getnewaddress (), 1.0 )
466
467
rawTx = self .nodes [0 ].getrawtransaction (txId , True )
467
468
vout = next (o for o in rawTx ['vout' ] if o ['value' ] == Decimal ('1.00000000' ))
468
469
469
470
self .sync_all ()
470
471
inputs = [{ "txid" : txId , "vout" : vout ['n' ] }]
471
- outputs = { self .nodes [0 ].getnewaddress () : Decimal ("0.98000000" ) } # 2000000 sat fee
472
+ # Fee 2,000,000 satoshis, (1 - (2000000 sat * 0.00000001 BTC/sat)) = 0.98
473
+ outputs = { self .nodes [0 ].getnewaddress () : Decimal ("0.98000000" ) }
472
474
rawTx = self .nodes [2 ].createrawtransaction (inputs , outputs )
473
475
rawTxSigned = self .nodes [2 ].signrawtransactionwithwallet (rawTx )
474
476
assert_equal (rawTxSigned ['complete' ], True )
475
- # 2000000 sat fee , ~100 b transaction, fee rate should land around 20000 sat/b = 0.20000000 BTC/kB
477
+ # Fee 2,000,000 satoshis , ~100 b transaction, fee rate should land around 20,000 sat/byte = 0.20000000 BTC/kB
476
478
# Thus, testmempoolaccept should reject
477
479
testres = self .nodes [2 ].testmempoolaccept ([rawTxSigned ['hex' ]])[0 ]
478
480
assert_equal (testres ['allowed' ], False )
479
481
assert_equal (testres ['reject-reason' ], '256: absurdly-high-fee' )
480
482
# and sendrawtransaction should throw
481
483
assert_raises_rpc_error (- 26 , "absurdly-high-fee" , self .nodes [2 ].sendrawtransaction , rawTxSigned ['hex' ])
482
- # And below calls should both succeed
484
+ # and the following calls should both succeed
483
485
testres = self .nodes [2 ].testmempoolaccept (rawtxs = [rawTxSigned ['hex' ]], maxfeerate = '0.20000000' )[0 ]
484
486
assert_equal (testres ['allowed' ], True )
485
487
self .nodes [2 ].sendrawtransaction (hexstring = rawTxSigned ['hex' ], maxfeerate = '0.20000000' )
0 commit comments