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 12e105a4c6ac1b9ce5b40d9ba32701a57a9dc589
parent 74cb53a12bc25d7846e56a4df08cef37859a64cc
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date:   Mon,  5 Nov 2018 19:07:38 +0000

Increase default initial_import_count to 1000

Some users who have received many transactions will overrun the old
default of 100 (issue #55), and the cost of this is high requiring
another rescan

Diffstat:
Mconfig.cfg_sample | 2+-
Melectrumpersonalserver/server/common.py | 8+++++---
Melectrumpersonalserver/server/transactionmonitor.py | 2+-
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/config.cfg_sample b/config.cfg_sample @@ -40,7 +40,7 @@ poll_interval_connected = 5 # Parameters for dealing with deterministic wallets # how many addresses to import first time, should be big because if you import too little you may have to rescan again -initial_import_count = 100 +initial_import_count = 1000 # number of unused addresses kept at the head of the wallet gap_limit = 25 diff --git a/electrumpersonalserver/server/common.py b/electrumpersonalserver/server/common.py @@ -484,13 +484,13 @@ def get_scriptpubkeys_to_monitor(rpc, config): first_spks = wal.get_scriptpubkeys(change=0, from_index=0, count=TEST_ADDR_COUNT) first_addrs = [hashes.script_to_address(s, rpc) for s in first_spks] + logger.info(" " + config_mpk_key + " => " + " ".join(first_addrs)) if not set(first_addrs).issubset(imported_addresses): import_needed = True wallets_imported += 1 for change in [0, 1]: spks_to_import.extend(wal.get_scriptpubkeys(change, 0, int(config.get("bitcoin-rpc", "initial_import_count")))) - logger.info(" " + config_mpk_key + " => " + " ".join(first_addrs)) #check whether watch-only addresses have been imported watch_only_addresses = [] for key in config.options("watch-only-addresses"): @@ -538,7 +538,8 @@ def get_scriptpubkeys_to_monitor(rpc, config): spks_to_monitor.extend([hashes.address_to_script(addr, rpc) for addr in watch_only_addresses]) et = time.time() - logger.info("Obtained list of addresses to monitor in " + str(et - st) + "sec") + logger.info("Obtained list of addresses to monitor in " + str(et - st) + + "sec") return False, spks_to_monitor, deterministic_wallets def get_certs(config): @@ -576,7 +577,8 @@ def obtain_rpc_username_password(datadir): "~/Library/Application Support/Bitcoin/") cookie_path = os.path.join(datadir, ".cookie") if not os.path.exists(cookie_path): - logger.warning("Unable to find .cookie file, try setting `datadir` config") + logger.warning("Unable to find .cookie file, try setting `datadir`" + + " config") return None, None fd = open(cookie_path) username, password = fd.read().strip().split(":") diff --git a/electrumpersonalserver/server/transactionmonitor.py b/electrumpersonalserver/server/transactionmonitor.py @@ -38,7 +38,7 @@ def import_addresses(rpc, addrs, logger=None): logger.debug("importing addrs = " + str(addrs)) logger.info("Importing " + str(len(addrs)) + " addresses in total") addr_i = iter(addrs) - notifications = 10 + notifications = 20 for i in range(notifications): pc = int(100.0 * i / notifications) sys.stdout.write("[" + str(pc) + "%]... ")