diff options
author | stickies-v <stickies-v@protonmail.com> | 2024-01-19 14:12:40 +0000 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2024-01-19 14:19:25 +0000 |
commit | 3bfc5bd36e38ca07306a41a3f56ea102ffe02b67 (patch) | |
tree | 10728e6c308abb84d620c585725e2e69df0bd133 /test/functional/wallet_import_rescan.py | |
parent | 5f3a0574c45477288bc678b15f24940486084576 (diff) | |
download | bitcoin-3bfc5bd36e38ca07306a41a3f56ea102ffe02b67.tar.xz |
test: ensure output is large enough to pay for its fees
Fixes a (rare) intermittency issue in wallet_import_rescan.
Since we use `subtract_fee_from_outputs=[0]` in the `send` command,
the output amount must at least be as large as the fee we're paying.
Diffstat (limited to 'test/functional/wallet_import_rescan.py')
-rwxr-xr-x | test/functional/wallet_import_rescan.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/functional/wallet_import_rescan.py b/test/functional/wallet_import_rescan.py index 7f01d23941..56cb71cd62 100755 --- a/test/functional/wallet_import_rescan.py +++ b/test/functional/wallet_import_rescan.py @@ -24,6 +24,7 @@ from test_framework.address import ( AddressType, ADDRESS_BCRT1_UNSPENDABLE, ) +from test_framework.messages import COIN from test_framework.util import ( assert_equal, set_node_times, @@ -270,7 +271,9 @@ class ImportRescanTest(BitcoinTestFramework): address_type=variant.address_type.value, )) variant.key = self.nodes[1].dumpprivkey(variant.address["address"]) - variant.initial_amount = get_rand_amount() * 2 + # Ensure output is large enough to pay for fees: conservatively assuming txsize of + # 500 vbytes and feerate of 20 sats/vbytes + variant.initial_amount = max(get_rand_amount(), (500 * 20 / COIN) + AMOUNT_DUST) variant.initial_txid = self.nodes[0].sendtoaddress(variant.address["address"], variant.initial_amount) variant.confirmation_height = 0 variant.timestamp = timestamp |