File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 23
23
assert_raises_rpc_error ,
24
24
count_bytes ,
25
25
find_vout_for_address ,
26
+ get_fee ,
26
27
)
27
28
from test_framework .wallet_util import generate_keypair
28
29
@@ -570,6 +571,8 @@ def test_locked_wallet(self):
570
571
df_wallet = self .nodes [1 ].get_wallet_rpc (self .default_wallet_name )
571
572
self .nodes [1 ].createwallet (wallet_name = "locked_wallet" , descriptors = self .options .descriptors )
572
573
wallet = self .nodes [1 ].get_wallet_rpc ("locked_wallet" )
574
+ # This test is not meant to exercise fee estimation. Making sure all txs are sent at a consistent fee rate.
575
+ wallet .settxfee (self .min_relay_tx_fee )
573
576
574
577
# Add some balance to the wallet (this will be reverted at the end of the test)
575
578
df_wallet .sendall (recipients = [wallet .getnewaddress ()])
@@ -599,8 +602,11 @@ def test_locked_wallet(self):
599
602
600
603
# Choose input
601
604
inputs = wallet .listunspent ()
602
- # Deduce fee to produce a changeless transaction
603
- value = inputs [0 ]["amount" ] - Decimal ("0.00002200" )
605
+
606
+ # Deduce exact fee to produce a changeless transaction
607
+ tx_size = 110 # Total tx size: 110 vbytes, p2wpkh -> p2wpkh. Input 68 vbytes + rest of tx is 42 vbytes.
608
+ value = inputs [0 ]["amount" ] - get_fee (tx_size , self .min_relay_tx_fee )
609
+
604
610
outputs = {self .nodes [0 ].getnewaddress ():value }
605
611
rawtx = wallet .createrawtransaction (inputs , outputs )
606
612
# fund a transaction that does not require a new key for the change output
You can’t perform that action at this time.
0 commit comments