commit 4653a1007cb8451c28461a326730900b285f38ad
parent 3f4e632cc44fc132d484d8e9e8da4bbe48f6db96
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 1 Oct 2018 15:49:26 +0200
daemon: more convenient constructor for scripts
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/electrum/daemon.py b/electrum/daemon.py
@@ -121,9 +121,12 @@ def get_rpc_credentials(config):
class Daemon(DaemonThread):
- def __init__(self, config, fd):
+ def __init__(self, config, fd=None):
DaemonThread.__init__(self)
self.config = config
+ if fd is None:
+ fd, server = get_fd_or_server(config)
+ if fd is None: raise Exception('failed to lock daemon; already running?')
if config.get('offline'):
self.network = None
else: