Use getblockhashafter command in getWalletRestoreHeight.

This commit is contained in:
tecnovert
2022-01-01 23:30:32 +02:00
parent 1476ad3cec
commit 3ba551c9da
6 changed files with 76 additions and 12 deletions

View File

@@ -107,7 +107,7 @@ def callrpc(rpc_port, auth, method, params=[], wallet=None, host='127.0.0.1'):
r = json.loads(v.decode('utf-8'))
except Exception as ex:
traceback.print_exc()
raise ValueError('RPC Server Error ' + str(ex))
raise ValueError('RPC server error ' + str(ex))
if 'error' in r and r['error'] is not None:
raise ValueError('RPC error ' + str(r['error']))
@@ -115,6 +115,17 @@ def callrpc(rpc_port, auth, method, params=[], wallet=None, host='127.0.0.1'):
return r['result']
def openrpc(rpc_port, auth, wallet=None, host='127.0.0.1'):
try:
url = 'http://{}@{}:{}/'.format(auth, host, rpc_port)
if wallet is not None:
url += 'wallet/' + urllib.parse.quote(wallet)
return Jsonrpc(url)
except Exception as ex:
traceback.print_exc()
raise ValueError('RPC error ' + str(ex))
def callrpc_cli(bindir, datadir, chain, cmd, cli_bin='particl-cli'):
cli_bin = os.path.join(bindir, cli_bin)