mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
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.
This commit is contained in:
parent
5f3a0574c4
commit
3bfc5bd36e
1 changed files with 4 additions and 1 deletions
|
@ -24,6 +24,7 @@ from test_framework.address import (
|
||||||
AddressType,
|
AddressType,
|
||||||
ADDRESS_BCRT1_UNSPENDABLE,
|
ADDRESS_BCRT1_UNSPENDABLE,
|
||||||
)
|
)
|
||||||
|
from test_framework.messages import COIN
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
set_node_times,
|
set_node_times,
|
||||||
|
@ -270,7 +271,9 @@ class ImportRescanTest(BitcoinTestFramework):
|
||||||
address_type=variant.address_type.value,
|
address_type=variant.address_type.value,
|
||||||
))
|
))
|
||||||
variant.key = self.nodes[1].dumpprivkey(variant.address["address"])
|
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.initial_txid = self.nodes[0].sendtoaddress(variant.address["address"], variant.initial_amount)
|
||||||
variant.confirmation_height = 0
|
variant.confirmation_height = 0
|
||||||
variant.timestamp = timestamp
|
variant.timestamp = timestamp
|
||||||
|
|
Loading…
Add table
Reference in a new issue