From 7fdedd5c4071e687bb5b3fa2b17a851e45947a97 Mon Sep 17 00:00:00 2001 From: ln2max <ln2max> Date: Tue, 17 Nov 2020 11:37:56 +0000 Subject: [PATCH] synchronizer: request missing txs for addresses in random order as discussed in issue #6697, users with large wallets or slow connections may never see their initial request-missing-tx run complete, if we always use the same sync order. This commit shuffles the addresses being requested every time a new request round happens, so that (if enough time passes and enough initial state requests are attempted) we will always get the latest state for each address, regardless of how quickly the connection times out on us --- electrum/synchronizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/synchronizer.py b/electrum/synchronizer.py index 3c9435754..9d619b47e 100644 --- a/electrum/synchronizer.py +++ b/electrum/synchronizer.py @@ -232,7 +232,7 @@ class Synchronizer(SynchronizerBase): async def main(self): self.wallet.set_up_to_date(False) # request missing txns, if any - for addr in self.wallet.db.get_history(): + for addr in random_shuffled_copy(self.wallet.db.get_history()): history = self.wallet.db.get_addr_history(addr) # Old electrum servers returned ['*'] when all history for the address # was pruned. This no longer happens but may remain in old wallets.