From 009cb4194102f400596fe2e6cb9fb9452260cccf Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 16 Aug 2022 20:35:49 +0000 Subject: [PATCH] Geth backwards-compatibility fix --- mmgen/base_proto/ethereum/daemon.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mmgen/base_proto/ethereum/daemon.py b/mmgen/base_proto/ethereum/daemon.py index f8fb3ab4..803ebe74 100755 --- a/mmgen/base_proto/ethereum/daemon.py +++ b/mmgen/base_proto/ethereum/daemon.py @@ -102,13 +102,21 @@ class geth_daemon(ethereum_daemon): version_info_arg = 'version' def init_subclass(self): + + def have_authrpc(): + from subprocess import run,PIPE + try: + return b'authrpc' in run(['geth','help'],check=True,stdout=PIPE).stdout + except: + return False + self.coind_args = list_gen( ['--verbosity=0'], ['--ipcdisable'], # IPC-RPC: if path to socket is longer than 108 chars, geth fails to start ['--http'], ['--http.api=eth,web3,txpool'], [f'--http.port={self.rpc_port}'], - [f'--authrpc.port={self.authrpc_port}'], + [f'--authrpc.port={self.authrpc_port}', have_authrpc()], [f'--port={self.p2p_port}', self.p2p_port], # geth binds p2p port even with --maxpeers=0 ['--maxpeers=0', not self.opt.online], [f'--datadir={self.datadir}', self.non_dfl_datadir],