Browse Source

Minor changes

MMGen 6 years ago
parent
commit
8aae3a8d31
3 changed files with 8 additions and 8 deletions
  1. 5 4
      mmgen/altcoins/eth/tx.py
  2. 1 1
      mmgen/obj.py
  3. 2 3
      test/test.py

+ 5 - 4
mmgen/altcoins/eth/tx.py

@@ -63,10 +63,11 @@ class EthereumMMGenTX(MMGenTX):
 		return g.rpch.eth_getTransactionReceipt('0x'+txid)
 
 	@classmethod
-	def get_exec_status(cls,txid):
+	def get_exec_status(cls,txid,silent=False):
 		d = g.rpch.eth_getTransactionReceipt('0x'+txid)
-		if 'contractAddress' in d and d['contractAddress']:
-			msg('Contract address: {}'.format(d['contractAddress'].replace('0x','')))
+		if not silent:
+			if 'contractAddress' in d and d['contractAddress']:
+				msg('Contract address: {}'.format(d['contractAddress'].replace('0x','')))
 		return int(d['status'],16)
 
 	def is_replaceable(self): return True
@@ -268,7 +269,7 @@ class EthereumMMGenTX(MMGenTX):
 	def format_view_verbose_footer(self): return '' # TODO
 
 	def set_g_token(self):
-		die(2,"Not a Token transaction object.  Have you omitted the '--token' option?")
+		die(2,"Transaction object mismatch.  Have you forgotten to include the '--token' option?")
 
 	def final_inputs_ok_msg(self,change_amt):
 		m = "Transaction leaves {} {} in the sender's account"

+ 1 - 1
mmgen/obj.py

@@ -342,7 +342,7 @@ class BTCAmt(Decimal,Hilite,InitErrors):
 	def to_unit(self,unit,show_decimal=False):
 		ret = Decimal(self) / getattr(self,unit)
 		if show_decimal and ret < 1:
-			return '{:.4f}'.format(ret)
+			return '{:.8f}'.format(ret).rstrip('0')
 		return int(ret)
 
 	@classmethod

+ 2 - 3
test/test.py

@@ -2312,7 +2312,6 @@ class MMGenTestSuite(object):
 		os.unlink(f1)
 		cmp_or_die(hincog_offset,int(o))
 
-	# Miscellaneous tests
 	def autosign(self,name): # tests everything except device detection, mount/unmount
 		if skip_for_win(): return
 		fdata = (('btc',''),('bch',''),('ltc','litecoin'),('eth','ethereum'))
@@ -3368,7 +3367,7 @@ class MMGenTestSuite(object):
 		txid = self.txsend_ui_common(t,mmgen_cmd,quiet=True,bogus_send=False,no_ok=True)
 		addr = t.expect_getend('Contract address: ')
 		from mmgen.altcoins.eth.tx import EthereumMMGenTX as etx
-		assert etx.get_exec_status(txid) != 0,"Contract '{}:{}' failed to execute. Aborting".format(num,key)
+		assert etx.get_exec_status(txid,True) != 0,"Contract '{}:{}' failed to execute. Aborting".format(num,key)
 		if key == 'Token':
 			write_to_tmpfile(cfg,'token_addr{}'.format(num),addr+'\n')
 			silence()
@@ -3404,7 +3403,7 @@ class MMGenTestSuite(object):
 			imsg('\n'+tk.info())
 			txid = tk.transfer(eth_addr,usr_addrs[i],1000,eth_key,
 								start_gas=ETHAmt(60000,'wei'),gasPrice=ETHAmt(8,'Gwei'))
-			assert etx.get_exec_status(txid) != 0,'Transfer of token funds failed. Aborting'
+			assert etx.get_exec_status(txid,True) != 0,'Transfer of token funds failed. Aborting'
 			imsg('dev token balance: {}'.format(tk.balance(eth_addr)))
 			imsg('usr{} token balance: {}'.format(i+1,tk.balance(usr_addrs[i])))
 		end_silence()