aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-06-23 12:23:42 +0200
committerMacroFake <falke.marco@gmail.com>2022-06-27 11:08:50 +0200
commitfa13375aa3fcb4fd5b9e0d4c69ac31cf66c3209a (patch)
tree1a4c88b035519d255ec9fabc3e42d477176a9493 /test/functional/test_framework
parentdddd7c4d390f54c5528986716c7c4089c4652ae9 (diff)
test: Sync MiniWallet utxo state after each generate call
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/wallet.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py
index 4c3fdbe2f5..68d5dfa880 100644
--- a/test/functional/test_framework/wallet.py
+++ b/test/functional/test_framework/wallet.py
@@ -147,12 +147,16 @@ class MiniWallet:
tx.rehash()
def generate(self, num_blocks, **kwargs):
- """Generate blocks with coinbase outputs to the internal address, and append the outputs to the internal list"""
+ """Generate blocks with coinbase outputs to the internal address, and call rescan_utxos"""
blocks = self._test_node.generatetodescriptor(num_blocks, self.get_descriptor(), **kwargs)
- for b in blocks:
- block_info = self._test_node.getblock(blockhash=b, verbosity=2)
- cb_tx = block_info['tx'][0]
- self._utxos.append(self._create_utxo(txid=cb_tx["txid"], vout=0, value=cb_tx["vout"][0]["value"], height=block_info["height"]))
+ # Calling rescan_utxos here makes sure that after a generate the utxo
+ # set is in a clean state. For example, the wallet will update
+ # - if the caller consumed utxos, but never used them
+ # - if the caller sent a transaction that is not mined or got rbf'd
+ # - after block re-orgs
+ # - the utxo height for mined mempool txs
+ # - However, the wallet will not consider remaining mempool txs
+ self.rescan_utxos()
return blocks
def get_scriptPubKey(self):