1111from test_framework .address import output_key_to_p2tr
1212from test_framework .key import H_POINT
1313from test_framework .test_framework import BitcoinTestFramework
14- from test_framework .util import assert_equal
14+ from test_framework .util import assert_equal , assert_fee_enough
1515from test_framework .descriptors import descsum_create
1616from test_framework .script import (
1717 CScript ,
@@ -296,8 +296,9 @@ def do_test_sendtoaddress(self, comment, pattern, privmap, treefn, keys_pay, key
296296 self .generatetoaddress (self .nodes [0 ], 1 , self .boring .getnewaddress (), sync_fun = self .no_op )
297297 test_balance = int (rpc_online .getbalance () * 100000000 )
298298 ret_amnt = random .randrange (100000 , test_balance )
299- # Increase fee_rate to compensate for the wallet's inability to estimate fees for script path spends.
300- res = rpc_online .sendtoaddress (address = self .boring .getnewaddress (), amount = Decimal (ret_amnt ) / 100000000 , subtractfeefromamount = True , fee_rate = 200 )
299+ res = rpc_online .sendtoaddress (address = self .boring .getnewaddress (), amount = Decimal (ret_amnt ) / 100000000 , subtractfeefromamount = True , fee_rate = 10 )
300+ txinfo = rpc_online .gettransaction (txid = res , verbose = True )
301+ assert_fee_enough (- txinfo ["fee" ], txinfo ["decoded" ]["vsize" ], Decimal (0.00010000 ))
301302 self .generatetoaddress (self .nodes [0 ], 1 , self .boring .getnewaddress (), sync_fun = self .no_op )
302303 assert (rpc_online .gettransaction (res )["confirmations" ] > 0 )
303304
@@ -348,8 +349,7 @@ def do_test_psbt(self, comment, pattern, privmap, treefn, keys_pay, keys_change)
348349 self .generatetoaddress (self .nodes [0 ], 1 , self .boring .getnewaddress (), sync_fun = self .no_op )
349350 test_balance = int (psbt_online .getbalance () * 100000000 )
350351 ret_amnt = random .randrange (100000 , test_balance )
351- # Increase fee_rate to compensate for the wallet's inability to estimate fees for script path spends.
352- psbt = psbt_online .walletcreatefundedpsbt ([], [{self .boring .getnewaddress (): Decimal (ret_amnt ) / 100000000 }], None , {"subtractFeeFromOutputs" :[0 ], "fee_rate" : 200 , "change_type" : address_type })['psbt' ]
352+ psbt = psbt_online .walletcreatefundedpsbt ([], [{self .boring .getnewaddress (): Decimal (ret_amnt ) / 100000000 }], None , {"subtractFeeFromOutputs" :[0 ], "fee_rate" : 10 , "change_type" : address_type })['psbt' ]
353353 res = psbt_offline .walletprocesspsbt (psbt = psbt , finalize = False )
354354 for wallet in [psbt_offline , key_only_wallet ]:
355355 res = wallet .walletprocesspsbt (psbt = psbt , finalize = False )
@@ -371,6 +371,8 @@ def do_test_psbt(self, comment, pattern, privmap, treefn, keys_pay, keys_change)
371371 assert res [0 ]["allowed" ]
372372
373373 txid = self .nodes [0 ].sendrawtransaction (rawtx )
374+ txinfo = psbt_online .gettransaction (txid = txid , verbose = True )
375+ assert_fee_enough (- txinfo ["fee" ], txinfo ["decoded" ]["vsize" ], Decimal (0.00010000 ))
374376 self .generatetoaddress (self .nodes [0 ], 1 , self .boring .getnewaddress (), sync_fun = self .no_op )
375377 assert (psbt_online .gettransaction (txid )['confirmations' ] > 0 )
376378
0 commit comments