File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -384,8 +384,7 @@ def _test_getblock(self):
384
384
node = self .nodes [0 ]
385
385
386
386
miniwallet = MiniWallet (node )
387
- miniwallet .generate (5 )
388
- node .generate (100 )
387
+ miniwallet .scan_blocks (num = 5 )
389
388
390
389
fee_per_byte = Decimal ('0.00000010' )
391
390
fee_per_kb = 1000 * fee_per_byte
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ def __init__(self, test_node):
32
32
self ._address = ADDRESS_BCRT1_P2WSH_OP_TRUE
33
33
self ._scriptPubKey = hex_str_to_bytes (self ._test_node .validateaddress (self ._address )['scriptPubKey' ])
34
34
35
+ def scan_blocks (self , * , start = 1 , num ):
36
+ """Scan the blocks for self._address outputs and add them to self._utxos"""
37
+ for i in range (start , start + num ):
38
+ block = self ._test_node .getblock (blockhash = self ._test_node .getblockhash (i ), verbosity = 2 )
39
+ for tx in block ['tx' ]:
40
+ for out in tx ['vout' ]:
41
+ if out ['scriptPubKey' ]['hex' ] == self ._scriptPubKey .hex ():
42
+ self ._utxos .append ({'txid' : tx ['txid' ], 'vout' : out ['n' ], 'value' : out ['value' ]})
43
+
35
44
def generate (self , num_blocks ):
36
45
"""Generate blocks with coinbase outputs to the internal address, and append the outputs to the internal list"""
37
46
blocks = self ._test_node .generatetoaddress (num_blocks , self ._address )
You can’t perform that action at this time.
0 commit comments