Browse Source

MMGenTX.Bump: fix spend amount display bug

The MMGen Project 4 years ago
parent
commit
ae40d09c84
3 changed files with 7 additions and 5 deletions
  1. 1 1
      mmgen/altcoins/eth/tx.py
  2. 1 0
      mmgen/main_txbump.py
  3. 5 4
      mmgen/tx.py

+ 1 - 1
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
 

+ 1 - 0
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

+ 5 - 4
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()