diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -32,7 +32,6 @@ self.log.info("Add 4 coinbase utxos to the miniwallet") # Block 76 contains the first spendable coinbase txs. first_block = 76 - wallet.rescan_utxos() # Three scenarios for re-orging coinbase spends in the memory pool: # 1. Direct coinbase spend : spend_1 diff --git a/test/functional/mempool_spend_coinbase.py b/test/functional/mempool_spend_coinbase.py --- a/test/functional/mempool_spend_coinbase.py +++ b/test/functional/mempool_spend_coinbase.py @@ -28,7 +28,6 @@ chain_height = 198 self.nodes[0].invalidateblock(self.nodes[0].getblockhash(chain_height + 1)) assert_equal(chain_height, self.nodes[0].getblockcount()) - wallet.rescan_utxos() # Coinbase at height chain_height-100+1 ok in mempool, should # get mined. Coinbase at height chain_height-100+2 is diff --git a/test/functional/p2p_blocksonly.py b/test/functional/p2p_blocksonly.py --- a/test/functional/p2p_blocksonly.py +++ b/test/functional/p2p_blocksonly.py @@ -19,9 +19,6 @@ def run_test(self): self.miniwallet = MiniWallet(self.nodes[0]) - # Add enough mature utxos to the wallet, so that all txs spend - # confirmed coins - self.miniwallet.rescan_utxos() self.blocksonly_mode_tests() self.blocks_relay_conn_tests() diff --git a/test/functional/p2p_filter.py b/test/functional/p2p_filter.py --- a/test/functional/p2p_filter.py +++ b/test/functional/p2p_filter.py @@ -281,7 +281,6 @@ def run_test(self): self.wallet = MiniWallet(self.nodes[0]) - self.wallet.rescan_utxos() filter_peer = self.nodes[0].add_p2p_connection(P2PBloomFilter()) self.log.info("Test filter size limits") diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -516,7 +516,6 @@ node = self.nodes[0] miniwallet = MiniWallet(node) - miniwallet.rescan_utxos() fee_per_byte = Decimal("0.1") fee_per_kb = 1000 * fee_per_byte diff --git a/test/functional/rpc_scantxoutset.py b/test/functional/rpc_scantxoutset.py --- a/test/functional/rpc_scantxoutset.py +++ b/test/functional/rpc_scantxoutset.py @@ -28,7 +28,6 @@ def run_test(self): self.wallet = MiniWallet(self.nodes[0]) - self.wallet.rescan_utxos() self.log.info("Create UTXOs...") pubk, spk, addr = getnewdestination() diff --git a/test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py b/test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py --- a/test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py +++ b/test/functional/setup_scripts/chronik-client_blocktxs_and_tx_and_rawtx.py @@ -25,7 +25,6 @@ # Init node = self.nodes[0] wallet = MiniWallet(node) - wallet.rescan_utxos() yield True diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -51,6 +51,13 @@ self._test_node.validateaddress(self._address)["scriptPubKey"] ) + # When the pre-mined test framework chain is used, it contains coinbase + # outputs to the MiniWallet's default address in blocks 76-100 + # (see method BitcoinTestFramework._initialize_chain()) + # The MiniWallet needs to rescan_utxos() in order to account + # for those mature UTXOs, so that all txs spend confirmed coins + self.rescan_utxos() + def _create_utxo(self, *, txid, vout, value, height): return {"txid": txid, "vout": vout, "value": value, "height": height}