From d62a3001bc8fcea3a5554284383a488291b28244 Mon Sep 17 00:00:00 2001 From: AlexCato Date: Wed, 21 Aug 2019 17:24:30 +0200 Subject: [PATCH] Fix sweeps with N=0 counterparties, which otherwise fails because the amount was changed from 0 too early --- scripts/sendpayment.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/sendpayment.py b/scripts/sendpayment.py index 6ce3189..b0b6630 100644 --- a/scripts/sendpayment.py +++ b/scripts/sendpayment.py @@ -138,11 +138,12 @@ def main(): # From the estimated tx fees, check if the expected amount is a # significant value compared the the cj amount - if amount == 0: - amount = wallet.get_balance_by_mixdepth()[options.mixdepth] - if amount == 0: + total_cj_amount = amount + if total_cj_amount == 0: + total_cj_amount = wallet.get_balance_by_mixdepth()[options.mixdepth] + if total_cj_amount == 0: raise ValueError("No confirmed coins in the selected mixdepth. Quitting") - exp_tx_fees_ratio = ((1 + options.makercount) * options.txfee) / amount + exp_tx_fees_ratio = ((1 + options.makercount) * options.txfee) / total_cj_amount if exp_tx_fees_ratio > 0.05: jmprint('WARNING: Expected bitcoin network miner fees for this coinjoin' ' amount are roughly {:.1%}'.format(exp_tx_fees_ratio), "warning")