From 0537a69d9c172da003244f59f0aad28ef16ea66f Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 10 Aug 2016 00:38:31 +0300 Subject: [PATCH] fix bug in yg-pe oidtoorder --- yg-pe.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yg-pe.py b/yg-pe.py index 559b4fd4..73f5de7b 100644 --- a/yg-pe.py +++ b/yg-pe.py @@ -106,14 +106,11 @@ def oid_to_order(self, cjorder, oid, amount): #to the next mixdepth. Otherwise, we set "cjoutdepth" to the minimum. nonmax_mix_balance = [m for m in filtered_mix_balance if m[0] != max_mix] - mixdepth = None - for m, bal in nonmax_mix_balance: - if m != max_mix: - mixdepth = m - break - if not mixdepth: + if not nonmax_mix_balance: log.debug("Could not spend from a mixdepth which is not max") mixdepth = max_mix + else: + mixdepth = nonmax_mix_balance[0][0] log.debug('filling offer, mixdepth=' + str(mixdepth)) # mixdepth is the chosen depth we'll be spending from @@ -121,6 +118,9 @@ def oid_to_order(self, cjorder, oid, amount): # to minimize chance of it becoming the largest, and reannouncing offer. if mixdepth == min_mix: cjoutmix = (mixdepth + 1) % self.wallet.max_mix_depth + #don't send cjout to max + if cjoutmix == max_mix: + cjoutmix = (cjoutmix + 1) % self.wallet.max_mix_depth else: cjoutmix = min_mix cj_addr = self.wallet.get_internal_addr(cjoutmix)