Browse Source

minor fixes, cleanups

The MMGen Project 3 years ago
parent
commit
7faa90cf40
4 changed files with 9 additions and 6 deletions
  1. 3 0
      mmgen/daemon.py
  2. 1 2
      mmgen/util.py
  3. 1 2
      mmgen/xmrwallet.py
  4. 4 2
      test/test_py_d/ts_ethdev.py

+ 3 - 0
mmgen/daemon.py

@@ -463,6 +463,8 @@ class CoinDaemon(Daemon):
 			port_shift = None,
 			datadir    = None ):
 
+		self.test_suite = test_suite
+
 		super().__init__()
 
 		self.shared_args = []
@@ -673,6 +675,7 @@ class EthereumDaemon(CoinDaemon):
 			[f'--ports-shift={self.port_shift}'],
 			[f'--base-path={chaindir}'],
 			['--config=dev'],
+			['--mode=offline',self.test_suite],
 			['--log-file='+os.path.join(self.datadir,'openethereum.log')],
 			['daemon',     ld],
 			[self.pidfile, ld],

+ 1 - 2
mmgen/util.py

@@ -21,6 +21,7 @@ util.py:  Low-level routines imported by other modules in the MMGen suite
 """
 
 import sys,os,time,stat,re
+from subprocess import run
 from hashlib import sha256
 from string import hexdigits,digits
 from .color import *
@@ -236,7 +237,6 @@ def check_or_create_dir(path):
 		os.listdir(path)
 	except:
 		if os.getenv('MMGEN_TEST_SUITE'):
-			from subprocess import run
 			try: # exception handling required for MSWin/MSYS2
 				run(['/bin/rm','-rf',path])
 			except:
@@ -813,7 +813,6 @@ def do_pager(text):
 
 	for pager in pagers:
 		try:
-			from subprocess import run
 			m = text + ('' if pager == 'less' else end_msg)
 			p = run([pager],input=m.encode(),check=True)
 			msg_r('\r')

+ 1 - 2
mmgen/xmrwallet.py

@@ -153,11 +153,10 @@ class MoneroMMGenTX:
 					}
 				},
 				cls = json_encoder,
-				indent = 4 # DEBUG
 			)
 			fn = '{}{}-XMR[{!s}]{}.sigtx'.format(
 				self.base_chksum.upper(),
-				('-'+self.full_chksum.upper()) if self.full_chksum else '',
+				(lambda s: f'-{s.upper()}' if s else '')(self.full_chksum),
 				self.data.amount,
 				(lambda s: '' if s == 'mainnet' else f'.{s}')(self.data.network),
 			)

+ 4 - 2
test/test_py_d/ts_ethdev.py

@@ -331,7 +331,8 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
 			from shutil import copytree
 			for d in ('mm1','mm2'):
 				copytree(os.path.join(srcdir,d),os.path.join(self.tmpdir,d))
-		start_test_daemons(self.proto.coin,remove_datadir=True)
+		if not opt.no_daemon_autostart:
+			start_test_daemons(self.proto.coin,remove_datadir=True)
 		return 'ok'
 
 	def wallet_upgrade(self,src_file):
@@ -993,5 +994,6 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
 
 	def stop(self):
 		self.spawn('',msg_only=True)
-		stop_test_daemons(self.proto.coin)
+		if not opt.no_daemon_stop:
+			stop_test_daemons(self.proto.coin)
 		return 'ok'