electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 7fdedd5c4071e687bb5b3fa2b17a851e45947a97
parent 42366ba57dea5f2b08c7c95882bcd0b59c7ae422
Author: ln2max <ln2max>
Date:   Tue, 17 Nov 2020 11:37:56 +0000

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

Diffstat:
Melectrum/synchronizer.py | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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.