From ae40d09c845d901779d375b2218b17de6f09ae64 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 23 Jun 2021 20:20:50 +0000 Subject: [PATCH] MMGenTX.Bump: fix spend amount display bug --- mmgen/altcoins/eth/tx.py | 2 +- mmgen/main_txbump.py | 1 + mmgen/tx.py | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mmgen/altcoins/eth/tx.py b/mmgen/altcoins/eth/tx.py index 10d55173..2a4d6d30 100755 --- a/mmgen/altcoins/eth/tx.py +++ b/mmgen/altcoins/eth/tx.py @@ -187,7 +187,7 @@ class EthereumMMGenTX: if self.outputs and self.outputs[0].is_chg: self.update_output_amt(0,ETHAmt(change_amt)) - def update_send_amt(self,foo): + def update_send_amt(self): if self.outputs: self.send_amt = self.outputs[0].amt diff --git a/mmgen/main_txbump.py b/mmgen/main_txbump.py index b1d2b7ea..758f1f71 100755 --- a/mmgen/main_txbump.py +++ b/mmgen/main_txbump.py @@ -152,6 +152,7 @@ async def main(): fee = tx.get_usr_fee_interactive(tx_fee=opt.tx_fee,desc='User-selected') tx.update_fee(op_idx,fee) + tx.update_send_amt() d = tx.get_fee() assert d == fee and d <= tx.proto.max_tx_fee diff --git a/mmgen/tx.py b/mmgen/tx.py index ce869b77..a21d3b31 100755 --- a/mmgen/tx.py +++ b/mmgen/tx.py @@ -834,9 +834,10 @@ class MMGenTX: else: self.update_output_amt(chg_idx,self.proto.coin_amt(change_amt)) - def update_send_amt(self,change_amt): - if not self.send_amt: - self.send_amt = change_amt + def update_send_amt(self): + self.send_amt = self.sum_outputs(exclude = + None if len(self.outputs) == 1 else self.get_chg_output_idx() + ) def check_fee(self): fee = self.sum_inputs() - self.sum_outputs() @@ -893,7 +894,7 @@ class MMGenTX: self.check_non_mmgen_inputs(caller) self.update_change_output(change_amt) - self.update_send_amt(change_amt) + self.update_send_amt() if self.proto.base_proto == 'Bitcoin': self.inputs.sort_bip69()