Skip to content

Commit

Permalink
pytest: initialize grpc_port value of LightningNode class with opti…
Browse files Browse the repository at this point in the history
…on value before the daemon is configured

this is important since `LightningD` now disables the grpc plugin if the
`grpc_port` is set to None
  • Loading branch information
jackstar12 committed Aug 12, 2024
1 parent b8c5779 commit ec5a53c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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)

Expand All @@ -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),
Expand Down

0 comments on commit ec5a53c

Please sign in to comment.