Skip to content

Commit faca688

Browse files
author
MarcoFalke
committed
test: Add MiniWallet get_descriptor function
1 parent 226731a commit faca688

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/functional/test_framework/wallet.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __init__(self, test_node, *, mode=MiniWalletMode.ADDRESS_OP_TRUE):
8282
def rescan_utxos(self):
8383
"""Drop all utxos and rescan the utxo set"""
8484
self._utxos = []
85-
res = self._test_node.scantxoutset(action="start", scanobjects=[f'raw({self._scriptPubKey.hex()})'])
85+
res = self._test_node.scantxoutset(action="start", scanobjects=[self.get_descriptor()])
8686
assert_equal(True, res['success'])
8787
for utxo in res['unspents']:
8888
self._utxos.append({'txid': utxo['txid'], 'vout': utxo['vout'], 'value': utxo['amount']})
@@ -117,12 +117,15 @@ def sign_tx(self, tx, fixed_length=True):
117117

118118
def generate(self, num_blocks):
119119
"""Generate blocks with coinbase outputs to the internal address, and append the outputs to the internal list"""
120-
blocks = self._test_node.generatetodescriptor(num_blocks, f'raw({self._scriptPubKey.hex()})')
120+
blocks = self._test_node.generatetodescriptor(num_blocks, self.get_descriptor())
121121
for b in blocks:
122122
cb_tx = self._test_node.getblock(blockhash=b, verbosity=2)['tx'][0]
123123
self._utxos.append({'txid': cb_tx['txid'], 'vout': 0, 'value': cb_tx['vout'][0]['value']})
124124
return blocks
125125

126+
def get_descriptor(self):
127+
return self._test_node.getdescriptorinfo(f'raw({self._scriptPubKey.hex()})')['descriptor']
128+
126129
def get_address(self):
127130
return self._address
128131

0 commit comments

Comments
 (0)