diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 32f94926c756..d5c64a07afb7 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -770,6 +770,7 @@ def __init__(self, node_id, lightning_dir, bitcoind, executor, valgrind, may_fai self.rc = 0 # Ensure we have an RPC we can use to talk to the node + self.grpc_port = options.get("grpc-port") self._create_rpc(jsonschemas) self.gossip_store = GossipStore(Path(lightning_dir, TEST_NETWORK, "gossip_store")) @@ -839,7 +840,8 @@ def _create_rpc(self, jsonschemas): def _create_grpc_rpc(self): from pyln.testing import grpc - self.grpc_port = reserve_unused_port() + if self.grpc_port is None: + self.grpc_port = reserve_unused_port() d = self.lightning_dir / TEST_NETWORK d.mkdir(parents=True, exist_ok=True) @@ -862,7 +864,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),