Browse Source

minor fixes and cleanups

The MMGen Project 2 years ago
parent
commit
38527779b4

+ 4 - 4
mmgen/base_proto/ethereum/daemon.py

@@ -89,8 +89,6 @@ class parity_daemon(openethereum_daemon):
 	exec_fn = 'parity'
 
 class geth_daemon(ethereum_daemon):
-	# bug in v1.10.17 requires --dev to be omitted to initialize blockchain (devnet_init_bug)
-	# daemon_data = _dd('Geth', 1010017, '1.10.17')
 	daemon_data = _dd('Geth', 1010021, '1.10.21')
 	version_pat = r'Geth/v(\d+)\.(\d+)\.(\d+)'
 	exec_fn = 'geth'
@@ -100,7 +98,8 @@ class geth_daemon(ethereum_daemon):
 		'linux': [g.home_dir,'.ethereum','geth'],
 		'win':   [os.getenv('LOCALAPPDATA'),'Geth'] # FIXME
 	}
-	avail_opts = ('no_daemonize','online','devnet_init_bug')
+	avail_opts = ('no_daemonize','online')
+	version_info_arg = 'version'
 
 	def init_subclass(self):
 		self.coind_args = list_gen(
@@ -114,7 +113,7 @@ class geth_daemon(ethereum_daemon):
 			['--maxpeers=0', not self.opt.online],
 			[f'--datadir={self.datadir}', self.non_dfl_datadir],
 			['--goerli', self.network=='testnet'],
-			['--dev', self.network=='regtest' and not self.opt.devnet_init_bug],
+			['--dev', self.network=='regtest'],
 		)
 
 # https://github.com/ledgerwatch/erigon
@@ -128,6 +127,7 @@ class erigon_daemon(geth_daemon):
 		'linux': [g.home_dir,'.local','share','erigon'],
 		'win':   [os.getenv('LOCALAPPDATA'),'Erigon'] # FIXME
 	}
+	version_info_arg = '--version'
 
 	def init_subclass(self):
 

+ 3 - 5
mmgen/daemon.py

@@ -259,6 +259,7 @@ class CoinDaemon(Daemon):
 	test_suite_port_shift = 1237
 	rpc_user = None
 	rpc_password = None
+	version_info_arg = '--version'
 
 	_cd = namedtuple('coins_data',['daemon_ids'])
 	coins = {
@@ -317,12 +318,9 @@ class CoinDaemon(Daemon):
 	@classmethod
 	def get_exec_version_str(cls):
 		try:
-			cp = run([cls.exec_fn,'--version'],stdout=PIPE,stderr=PIPE,check=True)
+			cp = run([cls.exec_fn,cls.version_info_arg],stdout=PIPE,stderr=PIPE,check=True)
 		except:
-			try:
-				cp = run([cls.exec_fn,'version'],stdout=PIPE,stderr=PIPE,check=True)
-			except:
-				die(2,f'Unable to execute {cls.exec_fn}')
+			die(2,f'Unable to execute {cls.exec_fn}')
 
 		if cp.returncode:
 			die(2,f'Unable to execute {cls.exec_fn}')

+ 0 - 12
test/test_py_d/ts_ethdev.py

@@ -415,17 +415,6 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
 	async def setup(self):
 		self.spawn('',msg_only=True)
 
-		async def geth_devnet_init_bug_workaround(): # devnet_init_bug
-			from mmgen.daemon import CoinDaemon
-			d = CoinDaemon(
-				self.proto.coin+'_rt',
-				test_suite = True,
-				opts       = ['devnet_init_bug'] )
-			d.start()
-			await asyncio.sleep(1)
-			d.stop()
-			await asyncio.sleep(1)
-
 		if not self.using_solc:
 			srcdir = os.path.join(self.tr.repo_root,'test','ref','ethereum','bin')
 			from shutil import copytree
@@ -437,7 +426,6 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
 		if d.id in ('geth','erigon'):
 			self.genesis_setup(d)
 			set_vt100()
-			# await geth_devnet_init_bug_workaround() # uncomment to enable testing with v1.10.17
 
 		if d.id == 'erigon':
 			self.write_to_tmpfile('signer_key',self.keystore_data['key']+'\n')

+ 1 - 1
test/test_py_d/ts_misc.py

@@ -39,7 +39,7 @@ class TestSuiteMisc(TestSuiteBase):
 	def rpc_backends(self):
 		backends = g.autoset_opts['rpc_backend'][1]
 		for b in backends:
-			t = self.spawn_chk('mmgen-tool',[f'--rpc-backend={b}','daemon_version'],extra_desc=f' ({b})')
+			t = self.spawn_chk('mmgen-tool',[f'--rpc-backend={b}','daemon_version'],extra_desc=f'({b})')
 		return t
 
 class TestSuiteHelp(TestSuiteBase):

+ 2 - 2
test/unit_tests_d/ut_testdep.py

@@ -39,11 +39,11 @@ class unit_tests:
 		return True
 
 	def keyconv(self,name,ut):
-		res = run(['keyconv','-G','ltc'],stdout=PIPE,stderr=PIPE)
+		res = run(['keyconv','-G','ltc'],stdout=PIPE,stderr=PIPE,check=True)
 		return True
 
 	def zcash_mini(self,name,ut):
-		res = run(['zcash-mini'],stdout=PIPE)
+		res = run(['zcash-mini'],stdout=PIPE,check=True)
 		return True
 
 	def ethkey(self,name,ut):