From 4653a1007cb8451c28461a326730900b285f38ad Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 1 Oct 2018 15:49:26 +0200 Subject: [PATCH] daemon: more convenient constructor for scripts --- electrum/daemon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electrum/daemon.py b/electrum/daemon.py index cc52b845b..672295d3a 100644 --- 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: