mirror of
https://github.com/JoinMarket-Org/joinmarket-clientserver.git
synced 2026-08-13 12:33:40 +02:00
fix wallet sync in fast mode
This commit is contained in:
parent
98f41f7c05
commit
9dd1dc7876
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import random
|
|||
import sys
|
||||
import time
|
||||
import binascii
|
||||
from copy import deepcopy
|
||||
from decimal import Decimal
|
||||
from twisted.internet import reactor, task
|
||||
|
||||
|
|
@ -463,13 +464,22 @@ class BitcoinCoreInterface(BlockchainInterface):
|
|||
|
||||
BATCH_SIZE = 100
|
||||
MAX_ITERATIONS = 20
|
||||
current_indices = deepcopy(saved_indices)
|
||||
for j in range(MAX_ITERATIONS):
|
||||
if not remaining_used_addresses:
|
||||
break
|
||||
for addr in \
|
||||
self._collect_addresses_gap(wallet, gap_limit=BATCH_SIZE):
|
||||
remaining_used_addresses.discard(addr)
|
||||
|
||||
# increase wallet indices for next iteration
|
||||
for md in current_indices:
|
||||
current_indices[md][0] += BATCH_SIZE
|
||||
current_indices[md][1] += BATCH_SIZE
|
||||
self._rewind_wallet_indices(wallet, current_indices,
|
||||
current_indices)
|
||||
else:
|
||||
self._rewind_wallet_indices(wallet, saved_indices, saved_indices)
|
||||
raise Exception("Failed to sync in fast mode after 20 batches; "
|
||||
"please re-try wallet sync without --fast flag.")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue