mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-16 18:39:59 +01:00
Merge #20385: test: run mempool_spend_coinbase.py even with wallet disabled
21f2433601test: run mempool_spend_coinbase.py even with wallet disabled (Michael Dietz) Pull request description: Run the mempool spend coinbase test even when the wallet was not compiled, as proposed in #20078. ACKs for top commit: laanwj: ACK21f2433601Tree-SHA512: 301582c04376371cfa8f1ebb2418a4341b42ddcd9ad4f48b58bcf888d867a97bdc409972856b67a8339ac5e60124aefee82a049b4f7fc6bca7a18d7e92e090be
This commit is contained in:
@@ -40,9 +40,20 @@ class MiniWallet:
|
||||
self._utxos.append({'txid': cb_tx['txid'], 'vout': 0, 'value': cb_tx['vout'][0]['value']})
|
||||
return blocks
|
||||
|
||||
def get_utxo(self):
|
||||
"""Return the last utxo. Can be used to get the change output immediately after a send_self_transfer"""
|
||||
return self._utxos.pop()
|
||||
def get_utxo(self, *, txid=''):
|
||||
"""
|
||||
Returns a utxo and marks it as spent (pops it from the internal list)
|
||||
|
||||
Args:
|
||||
txid (string), optional: get the first utxo we find from a specific transaction
|
||||
|
||||
Note: Can be used to get the change output immediately after a send_self_transfer
|
||||
"""
|
||||
index = -1 # by default the last utxo
|
||||
if txid:
|
||||
utxo = next(filter(lambda utxo: txid == utxo['txid'], self._utxos))
|
||||
index = self._utxos.index(utxo)
|
||||
return self._utxos.pop(index)
|
||||
|
||||
def send_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_spend=None):
|
||||
"""Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
|
||||
|
||||
Reference in New Issue
Block a user