mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
Set bootstrap-daemon-address to auto
get_block_count returns "Internal error" if bootstrap-daemon is active Use get_height instead.
This commit is contained in:
@@ -51,6 +51,23 @@ def callrpc_xmr_na(rpc_port, method, params=[], rpc_host='127.0.0.1', path='json
|
||||
return r['result']
|
||||
|
||||
|
||||
def callrpc_xmr2(rpc_port, method, params=None, rpc_host='127.0.0.1'):
|
||||
try:
|
||||
url = 'http://{}:{}/{}'.format(rpc_host, rpc_port, method)
|
||||
headers = {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
if params is None:
|
||||
p = requests.post(url, headers=headers)
|
||||
else:
|
||||
p = requests.post(url, data=json.dumps(params), headers=headers)
|
||||
r = json.loads(p.text)
|
||||
except Exception as ex:
|
||||
raise ValueError('RPC Server Error: {}'.format(str(ex)))
|
||||
|
||||
return r
|
||||
|
||||
|
||||
def make_xmr_rpc_func(port, host='127.0.0.1'):
|
||||
port = port
|
||||
host = host
|
||||
@@ -62,6 +79,17 @@ def make_xmr_rpc_func(port, host='127.0.0.1'):
|
||||
return rpc_func
|
||||
|
||||
|
||||
def make_xmr_rpc2_func(port, host='127.0.0.1'):
|
||||
port = port
|
||||
host = host
|
||||
|
||||
def rpc_func(method, params=None, wallet=None):
|
||||
nonlocal port
|
||||
nonlocal host
|
||||
return callrpc_xmr2(port, method, params, rpc_host=host)
|
||||
return rpc_func
|
||||
|
||||
|
||||
def make_xmr_wallet_rpc_func(port, auth, host='127.0.0.1'):
|
||||
port = port
|
||||
auth = auth
|
||||
|
||||
Reference in New Issue
Block a user