From fa6e599cf9fbacb393ac17e0a1b3572f217817f0 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 2 Dec 2024 14:34:41 +0100 Subject: [PATCH] test: Call generate through test framework only --- test/functional/mempool_ephemeral_dust.py | 10 +++++----- test/functional/rpc_getdescriptoractivity.py | 4 ++-- test/functional/wallet_migration.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/functional/mempool_ephemeral_dust.py b/test/functional/mempool_ephemeral_dust.py index 56e4b404e4..10cacd9539 100755 --- a/test/functional/mempool_ephemeral_dust.py +++ b/test/functional/mempool_ephemeral_dust.py @@ -325,7 +325,7 @@ class EphemeralDustTest(BitcoinTestFramework): dusty_tx, _ = self.create_ephemeral_dust_package(tx_version=3) assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, dusty_tx["hex"]) - block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_tx["hex"]]) + block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_tx["hex"]], sync_fun=self.no_op) self.nodes[0].invalidateblock(block_res["hash"]) assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"]], sync=False) @@ -335,7 +335,7 @@ class EphemeralDustTest(BitcoinTestFramework): assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, sweep_tx["hex"]) # Mine the sweep then re-org, the sweep will not make it back in due to spend checks - block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_tx["hex"], sweep_tx["hex"]]) + block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_tx["hex"], sweep_tx["hex"]], sync_fun=self.no_op) self.nodes[0].invalidateblock(block_res["hash"]) assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"]], sync=False) @@ -344,7 +344,7 @@ class EphemeralDustTest(BitcoinTestFramework): self.add_output_to_create_multi_result(sweep_tx_2) assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, sweep_tx_2["hex"]) - reconsider_block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_tx["hex"], sweep_tx_2["hex"]]) + reconsider_block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_tx["hex"], sweep_tx_2["hex"]], sync_fun=self.no_op) self.nodes[0].invalidateblock(reconsider_block_res["hash"]) assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"], sweep_tx_2["tx"]], sync=False) @@ -357,13 +357,13 @@ class EphemeralDustTest(BitcoinTestFramework): self.log.info("Test that ephemeral dust tx with fees or multi dust don't enter mempool via reorg") multi_dusty_tx, _ = self.create_ephemeral_dust_package(tx_version=3, num_dust_outputs=2) - block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [multi_dusty_tx["hex"]]) + block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [multi_dusty_tx["hex"]], sync_fun=self.no_op) self.nodes[0].invalidateblock(block_res["hash"]) assert_equal(self.nodes[0].getrawmempool(), []) # With fee and one dust dusty_fee_tx, _ = self.create_ephemeral_dust_package(tx_version=3, dust_tx_fee=1) - block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_fee_tx["hex"]]) + block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_fee_tx["hex"]], sync_fun=self.no_op) self.nodes[0].invalidateblock(block_res["hash"]) assert_equal(self.nodes[0].getrawmempool(), []) diff --git a/test/functional/rpc_getdescriptoractivity.py b/test/functional/rpc_getdescriptoractivity.py index 3efa1948b7..a0dc43718b 100755 --- a/test/functional/rpc_getdescriptoractivity.py +++ b/test/functional/rpc_getdescriptoractivity.py @@ -20,7 +20,7 @@ class GetBlocksActivityTest(BitcoinTestFramework): node = self.nodes[0] wallet = MiniWallet(node) node.setmocktime(node.getblockheader(node.getbestblockhash())['time']) - wallet.generate(200, invalid_call=False) + self.generate(wallet, 200) self.test_no_activity(node) self.test_activity_in_block(node, wallet) @@ -195,7 +195,7 @@ class GetBlocksActivityTest(BitcoinTestFramework): def test_no_address(self, node, wallet): raw_wallet = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK) - raw_wallet.generate(100, invalid_call=False) + self.generate(raw_wallet, 100) no_addr_tx = raw_wallet.send_self_transfer(from_node=node) raw_desc = raw_wallet.get_descriptor() diff --git a/test/functional/wallet_migration.py b/test/functional/wallet_migration.py index 5abb43e3b9..df9f3f0ba0 100755 --- a/test/functional/wallet_migration.py +++ b/test/functional/wallet_migration.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2020-2022 The Bitcoin Core developers +# Copyright (c) 2020-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Migrating a wallet from legacy to descriptor.""" @@ -461,7 +461,7 @@ class WalletMigrationTest(BitcoinTestFramework): addr_info = wallet.getaddressinfo(addr) desc = descsum_create("pk(" + addr_info["pubkey"] + ")") - self.master_node.generatetodescriptor(1, desc, invalid_call=False) + self.generatetodescriptor(self.master_node, 1, desc) bals = wallet.getbalances()