electrum-personal-server

Maximally lightweight electrum server for a single user
git clone https://git.parazyd.org/electrum-personal-server
Log | Files | Refs | README

commit 2239b92ebc4361a25187fb37cb5cf9d70e9a003b
parent 3a1ddde726ae3d218eca3a606756a6b11a70db4d
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date:   Mon,  2 Dec 2019 14:29:48 +0000

Wait for rescanning to finish

Core 0.19 adds a way to check whether the wallet is rescanning. Use
this to wait until rescan is finished. This allows scripts to call in
sequence EPS to import addresses, rescan and start up the server.

Diffstat:
Melectrumpersonalserver/server/common.py | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/electrumpersonalserver/server/common.py b/electrumpersonalserver/server/common.py @@ -818,6 +818,14 @@ def main(): if opts.rescan: rescan_script(logger, rpc, opts.rescan_date) return + while True: + logger.debug("Checking whether rescan is in progress") + walletinfo = rpc.call("getwalletinfo", []) + if "scanning" in walletinfo and walletinfo["scanning"]: + logger.debug("Waiting for Core wallet rescan to finish") + time.sleep(300) + continue + break import_needed, relevant_spks_addrs, deterministic_wallets = \ get_scriptpubkeys_to_monitor(rpc, config) if import_needed: