|
@ -121,10 +121,10 @@ def get_rpc_credentials(config): |
|
|
|
|
|
|
|
|
class Daemon(DaemonThread): |
|
|
class Daemon(DaemonThread): |
|
|
|
|
|
|
|
|
def __init__(self, config, fd=None): |
|
|
def __init__(self, config, fd=None, *, listen_jsonrpc=True): |
|
|
DaemonThread.__init__(self) |
|
|
DaemonThread.__init__(self) |
|
|
self.config = config |
|
|
self.config = config |
|
|
if fd is None: |
|
|
if fd is None and listen_jsonrpc: |
|
|
fd, server = get_fd_or_server(config) |
|
|
fd, server = get_fd_or_server(config) |
|
|
if fd is None: raise Exception('failed to lock daemon; already running?') |
|
|
if fd is None: raise Exception('failed to lock daemon; already running?') |
|
|
if config.get('offline'): |
|
|
if config.get('offline'): |
|
@ -137,7 +137,10 @@ class Daemon(DaemonThread): |
|
|
self.gui = None |
|
|
self.gui = None |
|
|
self.wallets = {} # type: Dict[str, Abstract_Wallet] |
|
|
self.wallets = {} # type: Dict[str, Abstract_Wallet] |
|
|
# Setup JSONRPC server |
|
|
# Setup JSONRPC server |
|
|
self.init_server(config, fd) |
|
|
self.server = None |
|
|
|
|
|
if listen_jsonrpc: |
|
|
|
|
|
self.init_server(config, fd) |
|
|
|
|
|
self.start() |
|
|
|
|
|
|
|
|
def init_server(self, config, fd): |
|
|
def init_server(self, config, fd): |
|
|
host = config.get('rpchost', '127.0.0.1') |
|
|
host = config.get('rpchost', '127.0.0.1') |
|
|