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 a2f3b0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 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") if options else None
self._create_rpc(jsonschemas)

self.gossip_store = GossipStore(Path(lightning_dir, TEST_NETWORK, "gossip_store"))
Expand Down Expand Up @@ -839,7 +840,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)

Expand All @@ -862,7 +863,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 a2f3b0e

Please sign in to comment.