joinmarket icon indicating copy to clipboard operation
joinmarket copied to clipboard

wallet-tool.py crash: IndexError: list index out of range

Open dreboli opened this issue 9 years ago • 11 comments

python wallet-tool.py wallet.json
2016-07-03 02:34:16,254 [MainThread  ] [DEBUG]  hello joinmarket
Enter wallet decryption passphrase: 
2016-07-03 02:34:20,821 [MainThread  ] [DEBUG]  requesting wallet history
2016-07-03 02:34:21,045 [MainThread  ] [DEBUG]  rpc: getaddressesbyaccount ['joinmarket-wallet-censored']
2016-07-03 02:34:21,066 [MainThread  ] [DEBUG]  rpc: listtransactions ['joinmarket-wallet-censored', 1000, 0, True]
Traceback (most recent call last):
  File "wallet-tool.py", line 103, in <module>
    jm_single().bc_interface.sync_wallet(wallet)
  File "censored/joinmarket/blockchaininterface.py", line 78, in sync_wallet
    self.sync_addresses(wallet)
  File "censored/joinmarket/blockchaininterface.py", line 641, in sync_addresses
    wallet.index_cache[mix_depth][forchange]])
IndexError: list index out of range

Tried the same with an other wallet and it worked as expected, so there might be something special with this one wallet that gave me the error. Running current dev branch

dreboli avatar Jul 03 '16 00:07 dreboli

You probably set this wallet up with fewer than 5 mixdepths? Run the tool with that command in that case: python wallet-tool.py -m [your_num_mixdepths] wallet.json

AlexCato avatar Jul 03 '16 00:07 AlexCato

I don't think the wallet was set up in a different way than the others, and I'm sure it had at least 5 mixdepths. wallet-tool.py works for up to -m 4, anything above throws that error.

dreboli avatar Jul 03 '16 10:07 dreboli

@dreboli what does index_cache look like in that wallet.json? Does it have 5 entries in the list?

AdamISZ avatar Jul 03 '16 12:07 AdamISZ

Only four. index_cache": [[111, 73], [19, 138], [1, 93], [0, 57]]

dreboli avatar Jul 03 '16 17:07 dreboli

So, the wallet was created with only 4 mixdepths; it can't be synced with 5, at least not as the code is currently.

AdamISZ avatar Jul 03 '16 18:07 AdamISZ

Think I deleted my last comment by mistake.

I have the output of wallet-tool.py wallet.json that was done right after the wallet was generated, I usually save this for every wallet I create along with it's seed. The last mixdepth is mixing depth 4 m/0/4/, this is the fifth mixdepth if I'm correct, so had 5 mixdepths when the wallet was generated.

Is it possible to change the number of mixdepths after the wallet was created? Maybe I did that by mistake? What's the command for it?

dreboli avatar Jul 04 '16 11:07 dreboli

I think you can manually edit the index cache. Definitely back up the wallet before doing this though. If I understand right you would just change the index cache to something like this: [[111, 73], [19, 138], [1, 93], [0, 57], [0, 0]] and then use a gap limit of 200 or so on your next run. Does anybody see a problem with doing that?

jamesphillipturpin avatar Jul 05 '16 19:07 jamesphillipturpin

Fwiw, I had the same problem, I'm pretty sure it was caused by running the tumbler.py script.

Waxwing said on IRC about restoring the fifth depth

technically there are scenarios where this could result in using addresses that were already proposed in incomplete transactions, so while it's easy to "fix" this changed-number-of-mixdepths scenario by just sort of wiping the slate clean, a proper solution would probably involve some more code.

Oh, yeah, seeing those 1000 TBTC disappear was kinda scary too.

nkuttler avatar Aug 06 '16 12:08 nkuttler

Yeah we should fix this. Leaving open for now, thanks.

AdamISZ avatar Aug 06 '16 19:08 AdamISZ

I marked this "medium difficulty" not because there's much code to write but because it requires thinking. Code will probably be trivial.

AdamISZ avatar Sep 15 '16 12:09 AdamISZ

I have a wallet with 5 mixdepths and I keep seeing this error as well. Reading thru the comments here I can't really grok and explanation; do you guys understand what's going on? I don't believe I've ever used mixdepths other than M = 5 for any wallets.

mecampbellsoup avatar Oct 21 '17 16:10 mecampbellsoup