py3port: initialize coin amts with '0' (str), not 0 (int)

This commit is contained in:
The MMGen Project 2018-10-31 15:47:56 +00:00
commit 1ef18c4fdb
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 5 additions and 5 deletions

View file

@ -134,7 +134,7 @@ class EthereumMMGenTX(MMGenTX):
self.txobj = {
'from': self.inputs[0].addr,
'to': self.outputs[0].addr if self.outputs else Str(''),
'amt': self.outputs[0].amt if self.outputs else ETHAmt(0),
'amt': self.outputs[0].amt if self.outputs else ETHAmt('0'),
'gasPrice': self.usr_rel_fee or self.fee_abs2rel(self.fee,to_unit='eth'),
'startGas': self.start_gas,
'nonce': self.get_nonce(),
@ -187,7 +187,7 @@ class EthereumMMGenTX(MMGenTX):
return [int(reply)]
# coin-specific fee routines:
def get_relay_fee(self): return ETHAmt(0) # TODO
def get_relay_fee(self): return ETHAmt('0') # TODO
# given absolute fee in ETH, return gas price in Gwei using tx_gas
def fee_abs2rel(self,abs_fee,to_unit='Gwei'):
@ -274,7 +274,7 @@ class EthereumMMGenTX(MMGenTX):
def final_inputs_ok_msg(self,change_amt):
m = "Transaction leaves {} {} in the sender's account"
chg = 0 if (self.outputs and self.outputs[0].is_chg) else change_amt
chg = '0' if (self.outputs and self.outputs[0].is_chg) else change_amt
return m.format(ETHAmt(chg).hl(),g.coin)
def do_sign(self,d,wif,tx_num_str):
@ -403,7 +403,7 @@ class EthereumTokenMMGenTX(EthereumMMGenTX):
def final_inputs_ok_msg(self,change_amt):
m = "Transaction leaves ≈{} {} and {} {} in the sender's account"
send_acct_tbal = 0 if self.outputs[0].is_chg else \
send_acct_tbal = '0' if self.outputs[0].is_chg else \
Token(g.token).balance(self.inputs[0].addr) - self.outputs[0].amt
return m.format(ETHAmt(change_amt).hl(),g.coin,ETHAmt(send_acct_tbal).hl(),g.dcoin)

View file

@ -335,7 +335,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
self.outputs.pop(idx)
def sum_outputs(self,exclude=None):
if not len(self.outputs): return g.proto.coin_amt(0)
if not len(self.outputs): return g.proto.coin_amt('0')
olist = self.outputs if exclude == None else \
self.outputs[:exclude] + self.outputs[exclude+1:]
return g.proto.coin_amt(sum(e.amt for e in olist))