diff options
author | brunoerg <brunoely.gc@gmail.com> | 2023-02-28 09:58:06 -0300 |
---|---|---|
committer | brunoerg <brunoely.gc@gmail.com> | 2023-05-19 09:13:17 -0300 |
commit | 60ced9007d518d542ce489b91076f9bbaf3312e3 (patch) | |
tree | 991235f37a354572973a4d58c62a8589ae79516f /test/functional/test_framework | |
parent | 7be7e62fdf4623e0cc680ea8205750c16414453e (diff) |
test: fix intermittent issue in `feature_bip68_sequence`
To avoid `bad-txns-premature-spend-of-coinbase` error,
when getting a utxo (using `get_utxo`) to create a new
transaction `get_utxo` shouldn't return by default
immature coinbase.
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r-- | test/functional/test_framework/wallet.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py index 64606b818b..90f7275b44 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)) |