From c878393df90bd7a9f2177d22fd0a872960f08179 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 14 Feb 2017 14:48:06 +0200 Subject: [PATCH] Dynamically expand index_cache if too small Re-application of https://github.com/JoinMarket-Org/joinmarket/commit/502b6a82a3ee2420642c29613328ef4ec51550b7 --- jmclient/jmclient/wallet.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jmclient/jmclient/wallet.py b/jmclient/jmclient/wallet.py index 60a7839..f6a2bc6 100644 --- a/jmclient/jmclient/wallet.py +++ b/jmclient/jmclient/wallet.py @@ -183,6 +183,13 @@ class Wallet(AbstractWallet): walletdata['network'], get_network())) if 'index_cache' in walletdata: self.index_cache = walletdata['index_cache'] + if self.max_mix_depth > len(self.index_cache): + #This can happen e.g. in tumbler when we need more mixdepths + #than currently exist. Since we have no info for those extra + #depths, we must default to (0,0) (but sync should find used + #adddresses). + self.index_cache += [[0,0]] * ( + self.max_mix_depth - len(self.index_cache)) password_key = btc.bin_dbl_sha256(pwd) encrypted_seed = walletdata['encrypted_seed'] try: