Skip to content

Commit 12e105a

Browse files
committed
Increase default initial_import_count to 1000
Some users who have received many transactions will overrun the old default of 100 (issue chris-belcher#55), and the cost of this is high requiring another rescan
1 parent 74cb53a commit 12e105a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

config.cfg_sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ poll_interval_connected = 5
4040

4141
# Parameters for dealing with deterministic wallets
4242
# how many addresses to import first time, should be big because if you import too little you may have to rescan again
43-
initial_import_count = 100
43+
initial_import_count = 1000
4444
# number of unused addresses kept at the head of the wallet
4545
gap_limit = 25
4646

electrumpersonalserver/server/common.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,13 @@ def get_scriptpubkeys_to_monitor(rpc, config):
484484
first_spks = wal.get_scriptpubkeys(change=0, from_index=0,
485485
count=TEST_ADDR_COUNT)
486486
first_addrs = [hashes.script_to_address(s, rpc) for s in first_spks]
487+
logger.info(" " + config_mpk_key + " => " + " ".join(first_addrs))
487488
if not set(first_addrs).issubset(imported_addresses):
488489
import_needed = True
489490
wallets_imported += 1
490491
for change in [0, 1]:
491492
spks_to_import.extend(wal.get_scriptpubkeys(change, 0,
492493
int(config.get("bitcoin-rpc", "initial_import_count"))))
493-
logger.info(" " + config_mpk_key + " => " + " ".join(first_addrs))
494494
#check whether watch-only addresses have been imported
495495
watch_only_addresses = []
496496
for key in config.options("watch-only-addresses"):
@@ -538,7 +538,8 @@ def get_scriptpubkeys_to_monitor(rpc, config):
538538
spks_to_monitor.extend([hashes.address_to_script(addr, rpc)
539539
for addr in watch_only_addresses])
540540
et = time.time()
541-
logger.info("Obtained list of addresses to monitor in " + str(et - st) + "sec")
541+
logger.info("Obtained list of addresses to monitor in " + str(et - st)
542+
+ "sec")
542543
return False, spks_to_monitor, deterministic_wallets
543544

544545
def get_certs(config):
@@ -576,7 +577,8 @@ def obtain_rpc_username_password(datadir):
576577
"~/Library/Application Support/Bitcoin/")
577578
cookie_path = os.path.join(datadir, ".cookie")
578579
if not os.path.exists(cookie_path):
579-
logger.warning("Unable to find .cookie file, try setting `datadir` config")
580+
logger.warning("Unable to find .cookie file, try setting `datadir`" +
581+
" config")
580582
return None, None
581583
fd = open(cookie_path)
582584
username, password = fd.read().strip().split(":")

electrumpersonalserver/server/transactionmonitor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def import_addresses(rpc, addrs, logger=None):
3838
logger.debug("importing addrs = " + str(addrs))
3939
logger.info("Importing " + str(len(addrs)) + " addresses in total")
4040
addr_i = iter(addrs)
41-
notifications = 10
41+
notifications = 20
4242
for i in range(notifications):
4343
pc = int(100.0 * i / notifications)
4444
sys.stdout.write("[" + str(pc) + "%]... ")

0 commit comments

Comments
 (0)