diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 32f94926c756..8b4dbbbc2b24 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -587,13 +587,14 @@ def __init__( port=9735, random_hsm=False, node_id=0, - grpc_port=None + grpc_port="9736" ): # We handle our own version of verbose, below. TailableProc.__init__(self, lightning_dir, verbose=False) self.executable = 'lightningd' self.lightning_dir = lightning_dir self.port = port + self.grpc_port = grpc_port self.cmd_prefix = [] self.rpcproxy = bitcoindproxy @@ -605,6 +606,8 @@ def __init__( 'addr': '127.0.0.1:{}'.format(port), 'allow-deprecated-apis': '{}'.format("true" if DEPRECATED_APIS else "false"), + 'grpc-port': grpc_port, + 'network': TEST_NETWORK, 'ignore-fee-limits': 'false', 'bitcoin-rpcuser': BITCOIND_CONFIG['rpcuser'], @@ -614,11 +617,6 @@ def __init__( 'bitcoin-datadir': lightning_dir, } - if grpc_port is not None: - opts['grpc-port'] = grpc_port - else: - opts['disable-plugin'] = 'cln-grpc' - for k, v in opts.items(): self.opts[k] = v @@ -765,6 +763,7 @@ def __init__(self, node_id, lightning_dir, bitcoind, executor, valgrind, may_fai self.allow_warning = allow_warning self.db = db self.lightning_dir = Path(lightning_dir) + self.grpc_port = options.get("grpc-port", "9736") if options else "9736" # Assume successful exit self.rc = 0 @@ -839,7 +838,7 @@ def _create_rpc(self, jsonschemas): def _create_grpc_rpc(self): from pyln.testing import grpc - self.grpc_port = reserve_unused_port() + self.grpc_port = self.grpc_port or reserve_unused_port() d = self.lightning_dir / TEST_NETWORK d.mkdir(parents=True, exist_ok=True) @@ -862,7 +861,6 @@ def _create_grpc_rpc(self): def _create_jsonrpc_rpc(self, jsonschemas): socket_path = self.lightning_dir / TEST_NETWORK / "lightning-rpc" - self.grpc_port = None self.rpc = PrettyPrintingLightningRpc( str(socket_path),