aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/wallet.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-02-16 17:48:01 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-02-16 17:47:55 +0100
commitfaa137eb9eac5554504b062a6dc865ca87fd572b (patch)
tree92fa04f755b2a1263fcd09cfc3c5d9ab557a39cf /test/functional/test_framework/wallet.py
parentfa1fe80c757df0adcbfaf41b5c5c8a468bc07b6f (diff)
downloadbitcoin-faa137eb9eac5554504b062a6dc865ca87fd572b.tar.xz
test: Speed up rpc_blockchain.py by removing miniwallet.generate()
Diffstat (limited to 'test/functional/test_framework/wallet.py')
-rw-r--r--test/functional/test_framework/wallet.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py
index edd7792608..38fbf3c1a6 100644
--- a/test/functional/test_framework/wallet.py
+++ b/test/functional/test_framework/wallet.py
@@ -32,6 +32,15 @@ class MiniWallet:
self._address = ADDRESS_BCRT1_P2WSH_OP_TRUE
self._scriptPubKey = hex_str_to_bytes(self._test_node.validateaddress(self._address)['scriptPubKey'])
+ def scan_blocks(self, *, start=1, num):
+ """Scan the blocks for self._address outputs and add them to self._utxos"""
+ for i in range(start, start + num):
+ block = self._test_node.getblock(blockhash=self._test_node.getblockhash(i), verbosity=2)
+ for tx in block['tx']:
+ for out in tx['vout']:
+ if out['scriptPubKey']['hex'] == self._scriptPubKey.hex():
+ self._utxos.append({'txid': tx['txid'], 'vout': out['n'], 'value': out['value']})
+
def generate(self, num_blocks):
"""Generate blocks with coinbase outputs to the internal address, and append the outputs to the internal list"""
blocks = self._test_node.generatetoaddress(num_blocks, self._address)