Browse Source

Try load RPC wallet on start-up if it's not loaded

master
Kristaps Kaupe 5 years ago
parent
commit
7f858222c4
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 11
      jmclient/jmclient/jsonrpc.py

11
jmclient/jmclient/jsonrpc.py

@ -54,17 +54,22 @@ class JsonRpc(object):
to connect to Bitcoin.
"""
def __init__(self, host, port, user, password, wallet_file=""):
def __init__(self, host, port, user, password, wallet_name=""):
self.host = host
self.port = int(port)
self.conn = http.client.HTTPConnection(self.host, self.port)
self.authstr = "%s:%s" % (user, password)
if len(wallet_file) > 0:
self.url = "/wallet/" + wallet_file
if len(wallet_name) > 0:
self.url = "/wallet/" + wallet_name
else:
self.url = ""
self.queryId = 1
# Check that RPC wallet is loaded. If not, try to load it.
loaded_wallets = self.call("listwallets", [])
if not wallet_name in loaded_wallets:
self.call("loadwallet", [wallet_name])
def queryHTTP(self, obj):
"""
Send an appropriate HTTP query to the server. The JSON-RPC

Loading…
Cancel
Save