Merge bitcoin/bitcoin#25087: test: use MiniWallet for feature_dbcrash.py

1da5e45725 test: use MiniWallet for feature_dbcrash.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (feature_dbcrash.py) to be run even with the Bitcoin Code wallet by using the MiniWallet instead, as proposed in https://github.com/bitcoin/bitcoin/issues/20078.

ACKs for top commit:
  laanwj:
    Code review ACK 1da5e45725
  brunoerg:
    crACK 1da5e45725

Tree-SHA512: 75ee9a32fd1451254004797d695d18032bd0fcb66ebd88cf737e147e43812525f6e884ec05fcc4f76f566dc71174c8ed7347bcdce16567db6511746ae64cead0
This commit is contained in:
MacroFake
2022-06-01 16:39:36 +02:00
2 changed files with 34 additions and 28 deletions

View File

@@ -167,6 +167,13 @@ class MiniWallet:
else:
return self._utxos[index]
def get_utxos(self, *, mark_as_spent=True):
"""Returns the list of all utxos and optionally mark them as spent"""
utxos = deepcopy(self._utxos)
if mark_as_spent:
self._utxos = []
return utxos
def send_self_transfer(self, **kwargs):
"""Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
tx = self.create_self_transfer(**kwargs)