Browse Source

py3port: a few encoding fixes

MMGen 6 years ago
parent
commit
d91328c2b1
2 changed files with 4 additions and 4 deletions
  1. 2 2
      mmgen/altcoins/eth/tx.py
  2. 2 2
      test/gentest.py

+ 2 - 2
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']:

+ 2 - 2
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'):