Skip to content

Commit

Permalink
fix: add rpc server port in integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Lakshya Singh <[email protected]>
  • Loading branch information
king-11 authored and ksedgwic committed Feb 14, 2024
1 parent fecc928 commit a1a2326
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def getnewaddress(self):


class ValidatingLightningSignerD(TailableProc):
def __init__(self, vlsd_dir, vlsd_port, node_id, network):
def __init__(self, vlsd_dir, vlsd_port, vlsd_rpc_port, node_id, network):
TailableProc.__init__(self, vlsd_dir, verbose=True)
self.executable = env("REMOTE_SIGNER_CMD", 'vlsd2')
os.environ['ALLOWLIST'] = env(
Expand All @@ -629,6 +629,7 @@ def __init__(self, vlsd_dir, vlsd_port, node_id, network):
'--network={}'.format(network),
'--datadir={}'.format(vlsd_dir),
'--connect=http://localhost:{}'.format(vlsd_port),
'--rpc-server-port={}'.format(vlsd_rpc_port),
'--integration-test',
]
self.prefix = 'vlsd2-%d' % (node_id)
Expand Down Expand Up @@ -676,6 +677,7 @@ def __init__(
self.use_vlsd = False
self.vlsd_dir = os.path.join(lightning_dir, "vlsd")
self.vlsd_port = None
self.vlsd_rpc_server_port = None
self.vlsd = None
self.node_id = node_id

Expand Down Expand Up @@ -794,6 +796,7 @@ def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):

if self.use_vlsd:
self.vlsd_port = reserve_unused_port()
self.vlsd_rpc_server_port = reserve_unused_port()
# We can't do this in the constructor because we need a new port on each restart.
self.env['VLS_PORT'] = str(self.vlsd_port)
# Kill any previous vlsd (we may have been restarted)
Expand All @@ -806,7 +809,7 @@ def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
if self.use_vlsd:
# Start the remote signer first
self.vlsd = ValidatingLightningSignerD(
self.vlsd_dir, self.vlsd_port, self.node_id, self.opts['network'])
self.vlsd_dir, self.vlsd_port, self.vlsd_rpc_server_port, self.node_id, self.opts['network'])
self.vlsd.start(
stdin, stdout_redir=True, stderr_redir=True,
wait_for_initialized=wait_for_initialized)
Expand Down

0 comments on commit a1a2326

Please sign in to comment.