Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Commit b25cb65

Browse files
author
Dan Weatherill
committed
simple implementation of starting from first non-empty level in joinmarket wallet for issue #260
fixed sorting of list of levels properly update options.mixdepthsrc instead of having new variable
1 parent d686647 commit b25cb65

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tumbler.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,20 @@ def main():
358358
wallet = Wallet(wallet_file, max_mix_depth = options.mixdepthsrc + options.mixdepthcount)
359359
common.bc_interface.sync_wallet(wallet)
360360

361+
#check if there are actually any coins at the mixdepthsrc level
362+
#if not, allow user to start at minimum used level
363+
used_depths = [k for k,v in wallet.get_utxos_by_mixdepth().iteritems() if v != {}]
364+
if options.mixdepthsrc not in used_depths:
365+
ret = raw_input("no coins in chosen src level. Use lowest possible level? (y/n):")
366+
if ret[0] !='y':
367+
return
368+
options.mixdepthsrc = sorted(used_depths.keys())[0]
369+
print "starting with depth: " + str(options.mixdepthsrc)
370+
wallet = Wallet(wallet_file,max_mix_depth = options.mixdepthsrc + options.mixdepthcount)
371+
common.bc_interface.sync_wallet(wallet)
372+
373+
374+
361375
common.nickname = random_nick()
362376
debug('starting tumbler')
363377
irc = IRCMessageChannel(common.nickname)

0 commit comments

Comments
 (0)