diff --git a/test/functional/mempool_compatibility.py b/test/functional/mempool_compatibility.py index a7bdc496954..7337802aea0 100755 --- a/test/functional/mempool_compatibility.py +++ b/test/functional/mempool_compatibility.py @@ -47,12 +47,12 @@ class MempoolCompatibilityTest(BitcoinTestFramework): # unbroadcasted_tx won't pass old_node's `MemPoolAccept::PreChecks`. self.connect_nodes(0, 1) self.sync_blocks() - self.stop_node(1) self.log.info("Add a transaction to mempool on old node and shutdown") old_tx_hash = new_wallet.send_self_transfer(from_node=old_node)["txid"] assert old_tx_hash in old_node.getrawmempool() self.stop_node(0) + self.stop_node(1) self.log.info("Move mempool.dat from old to new node") old_node_mempool = os.path.join(old_node.datadir, self.chain, 'mempool.dat') diff --git a/test/functional/mempool_persist.py b/test/functional/mempool_persist.py index f8188011363..8f74d9de206 100755 --- a/test/functional/mempool_persist.py +++ b/test/functional/mempool_persist.py @@ -191,6 +191,7 @@ class MempoolPersistTest(BitcoinTestFramework): def test_persist_unbroadcast(self): node0 = self.nodes[0] self.start_node(0) + self.start_node(2) # clear out mempool self.generate(node0, 1, sync_fun=self.no_op) diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py index 64606b818b6..90f7275b44d 100644 --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -218,10 +218,12 @@ class MiniWallet: txid: get the first utxo we find from a specific transaction """ self._utxos = sorted(self._utxos, key=lambda k: (k['value'], -k['height'])) # Put the largest utxo last + blocks_height = self._test_node.getblockchaininfo()['blocks'] + mature_coins = list(filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY - 1 <= blocks_height - utxo['height'], self._utxos)) if txid: utxo_filter: Any = filter(lambda utxo: txid == utxo['txid'], self._utxos) else: - utxo_filter = reversed(self._utxos) # By default the largest utxo + utxo_filter = reversed(mature_coins) # By default the largest utxo if vout is not None: utxo_filter = filter(lambda utxo: vout == utxo['vout'], utxo_filter) index = self._utxos.index(next(utxo_filter))