Fixes a (rare) intermittency issue in wallet_import_rescan.py
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.
Example in CI: https://api.cirrus-ci.com/v1/task/6107972259020800/logs/ci.log
02024-01-18T22:16:12.383000Z TestFramework (INFO): Test that the mempool is rescanned as well if the rescan parameter is set to true
12024-01-18T22:16:20.187000Z TestFramework (ERROR): JSONRPC error
2Traceback (most recent call last):
3 File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 131, in main
4 self.run_test()
5 File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_import_rescan.py", line 292, in run_test
6 child = self.nodes[1].send(
7 File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/coverage.py", line 50, in __call__
8 return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
9 File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/authproxy.py", line 129, in __call__
10 raise JSONRPCException(response['error'], status)
11test_framework.authproxy.JSONRPCException: The transaction amount is too small to pay the fee (-4)
Can be reproduced locally by forcing usage of the lowest possible value produced by get_rand_amount()
(thanks furszy):
0diff --git a/test/functional/wallet_import_rescan.py b/test/functional/wallet_import_rescan.py
1index 7f01d23941..925849d5c0 100755
2--- a/test/functional/wallet_import_rescan.py
3+++ b/test/functional/wallet_import_rescan.py
4@@ -270,7 +270,7 @@ class ImportRescanTest(BitcoinTestFramework):
5 address_type=variant.address_type.value,
6 ))
7 variant.key = self.nodes[1].dumpprivkey(variant.address["address"])
8- variant.initial_amount = get_rand_amount() * 2
9+ variant.initial_amount = Decimal(str(round(AMOUNT_DUST, 8))) * 2
10 variant.initial_txid = self.nodes[0].sendtoaddress(variant.address["address"], variant.initial_amount)
11 variant.confirmation_height = 0
12 variant.timestamp = timestamp