mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 01:09:14 +01:00
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
This commit is contained in:
@@ -235,7 +235,8 @@ class MiniWallet:
|
|||||||
def get_utxos(self, *, include_immature_coinbase=False, mark_as_spent=True):
|
def get_utxos(self, *, include_immature_coinbase=False, mark_as_spent=True):
|
||||||
"""Returns the list of all utxos and optionally mark them as spent"""
|
"""Returns the list of all utxos and optionally mark them as spent"""
|
||||||
if not include_immature_coinbase:
|
if not include_immature_coinbase:
|
||||||
utxo_filter = filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY <= utxo['confirmations'], self._utxos)
|
blocks_height = self._test_node.getblockchaininfo()['blocks']
|
||||||
|
utxo_filter = filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY - 1 <= blocks_height - utxo['height'], self._utxos)
|
||||||
else:
|
else:
|
||||||
utxo_filter = self._utxos
|
utxo_filter = self._utxos
|
||||||
utxos = deepcopy(list(utxo_filter))
|
utxos = deepcopy(list(utxo_filter))
|
||||||
|
|||||||
Reference in New Issue
Block a user