mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Merge bitcoin/bitcoin#28232: test: locked_wallet, skip default fee estimation
5364dd8666test: locked_wallet, skip default fee estimation (furszy) Pull request description: Coming from https://github.com/bitcoin/bitcoin/pull/28139#discussion_r1284563239. No test case in this file is meant to exercise fee estimation. All default wallets have a custom tx fee set [here](b7138252ac/test/functional/wallet_fundrawtransaction.py (L100)). The only one missing is the one created for `locked_wallet`. ACKs for top commit: theStack: ACK5364dd8666Tree-SHA512: 514c02708081d18330d759d10e306cee16c6350de243c68f0973777d2582f5d81968a237393c1f59aba245297e03f3f98d3ae5249a042469d0d016255f568719
This commit is contained in:
@@ -23,6 +23,7 @@ from test_framework.util import (
|
|||||||
assert_raises_rpc_error,
|
assert_raises_rpc_error,
|
||||||
count_bytes,
|
count_bytes,
|
||||||
find_vout_for_address,
|
find_vout_for_address,
|
||||||
|
get_fee,
|
||||||
)
|
)
|
||||||
from test_framework.wallet_util import generate_keypair
|
from test_framework.wallet_util import generate_keypair
|
||||||
|
|
||||||
@@ -570,6 +571,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||||||
df_wallet = self.nodes[1].get_wallet_rpc(self.default_wallet_name)
|
df_wallet = self.nodes[1].get_wallet_rpc(self.default_wallet_name)
|
||||||
self.nodes[1].createwallet(wallet_name="locked_wallet", descriptors=self.options.descriptors)
|
self.nodes[1].createwallet(wallet_name="locked_wallet", descriptors=self.options.descriptors)
|
||||||
wallet = self.nodes[1].get_wallet_rpc("locked_wallet")
|
wallet = self.nodes[1].get_wallet_rpc("locked_wallet")
|
||||||
|
# This test is not meant to exercise fee estimation. Making sure all txs are sent at a consistent fee rate.
|
||||||
|
wallet.settxfee(self.min_relay_tx_fee)
|
||||||
|
|
||||||
# Add some balance to the wallet (this will be reverted at the end of the test)
|
# Add some balance to the wallet (this will be reverted at the end of the test)
|
||||||
df_wallet.sendall(recipients=[wallet.getnewaddress()])
|
df_wallet.sendall(recipients=[wallet.getnewaddress()])
|
||||||
@@ -599,8 +602,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Choose input
|
# Choose input
|
||||||
inputs = wallet.listunspent()
|
inputs = wallet.listunspent()
|
||||||
# Deduce fee to produce a changeless transaction
|
|
||||||
value = inputs[0]["amount"] - Decimal("0.00002200")
|
# Deduce exact fee to produce a changeless transaction
|
||||||
|
tx_size = 110 # Total tx size: 110 vbytes, p2wpkh -> p2wpkh. Input 68 vbytes + rest of tx is 42 vbytes.
|
||||||
|
value = inputs[0]["amount"] - get_fee(tx_size, self.min_relay_tx_fee)
|
||||||
|
|
||||||
outputs = {self.nodes[0].getnewaddress():value}
|
outputs = {self.nodes[0].getnewaddress():value}
|
||||||
rawtx = wallet.createrawtransaction(inputs, outputs)
|
rawtx = wallet.createrawtransaction(inputs, outputs)
|
||||||
# fund a transaction that does not require a new key for the change output
|
# fund a transaction that does not require a new key for the change output
|
||||||
|
|||||||
Reference in New Issue
Block a user