From d91328c2b1ee78edbdcbd6c79a50f82597a4f603 Mon Sep 17 00:00:00 2001 From: MMGen Date: Sun, 10 Feb 2019 19:19:55 +0000 Subject: [PATCH] py3port: a few encoding fixes --- mmgen/altcoins/eth/tx.py | 4 ++-- test/gentest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mmgen/altcoins/eth/tx.py b/mmgen/altcoins/eth/tx.py index 9b31beb1..5445bcda 100755 --- a/mmgen/altcoins/eth/tx.py +++ b/mmgen/altcoins/eth/tx.py @@ -110,7 +110,7 @@ class EthereumMMGenTX(MMGenTX): txid = CoinTxID(hexlify(etx.hash)) assert txid == self.coin_txid,"txid in tx.hex doesn't match value in MMGen transaction file" else: - d = json.loads(self.hex) + d = json.loads(self.hex.decode()) o = { 'from': CoinAddr(d['from']), 'to': CoinAddr(d['to']) if d['to'] else Str(''), 'amt': ETHAmt(d['amt']), @@ -417,7 +417,7 @@ class EthereumTokenMMGenTX(EthereumMMGenTX): def set_g_token(self): g.dcoin = self.dcoin if is_hex_bytes(self.hex): return # for txsend we can leave g.token uninitialized - d = json.loads(self.hex) + d = json.loads(self.hex.decode()) if g.token.upper() == self.dcoin: g.token = d['token_addr'] elif g.token != d['token_addr']: diff --git a/test/gentest.py b/test/gentest.py index ce16fd76..8f095e7d 100755 --- a/test/gentest.py +++ b/test/gentest.py @@ -81,7 +81,7 @@ if not 1 <= len(cmd_args) <= 2: opts.usage() addr_type = MMGenAddrType(opt.type or g.proto.dfl_mmtype) def pyethereum_sec2addr(sec): - return sec.decode(),hexlify(eth.privtoaddr(sec)).decode() + return sec.decode(),hexlify(eth.privtoaddr(sec.decode())).decode() def keyconv_sec2addr(sec): p = sp.Popen(['keyconv','-C',g.coin,sec.wif],stderr=sp.PIPE,stdout=sp.PIPE) @@ -126,7 +126,7 @@ def init_external_prog(): try: import ethereum.utils as eth except: - raise ImportError("Unable to import 'pyethereum' module. Is pyethereum installed?") + raise ImportError("Unable to import 'ethereum' module. Is pyethereum installed?") ext_sec2addr = pyethereum_sec2addr ext_lib = 'pyethereum' elif test_support('pycoin'):