From 747c2277626a8e2e0932fb488b86795e33de7401 Mon Sep 17 00:00:00 2001 From: undeath Date: Wed, 11 Jul 2018 17:56:09 +0200 Subject: [PATCH] fix some max_mixdepth off-by-one errors --- jmclient/jmclient/taker.py | 2 +- jmclient/jmclient/yieldgenerator.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jmclient/jmclient/taker.py b/jmclient/jmclient/taker.py index a567645..bcc02a4 100644 --- a/jmclient/jmclient/taker.py +++ b/jmclient/jmclient/taker.py @@ -179,7 +179,7 @@ class Taker(object): #if destination is flagged "INTERNAL", choose a destination #from the next mixdepth modulo the maxmixdepth if self.my_cj_addr == "INTERNAL": - next_mixdepth = (self.mixdepth + 1) % self.wallet.max_mix_depth + next_mixdepth = (self.mixdepth + 1) % (self.wallet.max_mixdepth + 1) jlog.info("Choosing a destination from mixdepth: " + str(next_mixdepth)) self.my_cj_addr = self.wallet.get_internal_addr(next_mixdepth) jlog.info("Chose destination address: " + self.my_cj_addr) diff --git a/jmclient/jmclient/yieldgenerator.py b/jmclient/jmclient/yieldgenerator.py index e3152b6..1ec25df 100644 --- a/jmclient/jmclient/yieldgenerator.py +++ b/jmclient/jmclient/yieldgenerator.py @@ -129,8 +129,8 @@ class YieldGeneratorBasic(YieldGenerator): jlog.info('filling offer, mixdepth=' + str(mixdepth)) # mixdepth is the chosen depth we'll be spending from - cj_addr = self.wallet.get_internal_addr((mixdepth + 1) % - self.wallet.max_mix_depth) + cj_addr = self.wallet.get_internal_addr( + (mixdepth + 1) % (self.wallet.max_mixdepth + 1)) change_addr = self.wallet.get_internal_addr(mixdepth) self.import_new_addresses([cj_addr, change_addr])