Skip to content

Commit aadaa56

Browse files
committed
Merge bitcoin/bitcoin#28232: test: locked_wallet, skip default fee estimation
5364dd8 test: locked_wallet, skip default fee estimation (furszy) Pull request description: Coming from bitcoin/bitcoin#28139 (comment). No test case in this file is meant to exercise fee estimation. All default wallets have a custom tx fee set [here](https://github.com/bitcoin/bitcoin/blob/b7138252ace6d21476964774e094ed1143cd7a1c/test/functional/wallet_fundrawtransaction.py#L100). The only one missing is the one created for `locked_wallet`. ACKs for top commit: theStack: ACK 5364dd8 Tree-SHA512: 514c02708081d18330d759d10e306cee16c6350de243c68f0973777d2582f5d81968a237393c1f59aba245297e03f3f98d3ae5249a042469d0d016255f568719
2 parents 6c508ac + 5364dd8 commit aadaa56

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/functional/wallet_fundrawtransaction.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
assert_raises_rpc_error,
2424
count_bytes,
2525
find_vout_for_address,
26+
get_fee,
2627
)
2728
from test_framework.wallet_util import generate_keypair
2829

@@ -570,6 +571,8 @@ def test_locked_wallet(self):
570571
df_wallet = self.nodes[1].get_wallet_rpc(self.default_wallet_name)
571572
self.nodes[1].createwallet(wallet_name="locked_wallet", descriptors=self.options.descriptors)
572573
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)
573576

574577
# Add some balance to the wallet (this will be reverted at the end of the test)
575578
df_wallet.sendall(recipients=[wallet.getnewaddress()])
@@ -599,8 +602,11 @@ def test_locked_wallet(self):
599602

600603
# Choose input
601604
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+
604610
outputs = {self.nodes[0].getnewaddress():value}
605611
rawtx = wallet.createrawtransaction(inputs, outputs)
606612
# fund a transaction that does not require a new key for the change output

0 commit comments

Comments
 (0)