Skip to content

Commit 272eb55

Browse files
committed
test: fix include_immature_coinbase logic in get_utxos
Use current block height to compute the confirmation count instead of using the value from utxo object
1 parent a951c34 commit 272eb55

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/functional/test_framework/wallet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ def get_utxo(self, *, txid: str = '', vout: Optional[int] = None, mark_as_spent=
235235
def get_utxos(self, *, include_immature_coinbase=False, mark_as_spent=True):
236236
"""Returns the list of all utxos and optionally mark them as spent"""
237237
if not include_immature_coinbase:
238-
utxo_filter = filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY <= utxo['confirmations'], self._utxos)
238+
blocks_height = self._test_node.getblockchaininfo()['blocks']
239+
utxo_filter = filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY - 1 <= blocks_height - utxo['height'], self._utxos)
239240
else:
240241
utxo_filter = self._utxos
241242
utxos = deepcopy(list(utxo_filter))

0 commit comments

Comments
 (0)