Skip to content

Commit cd0860e

Browse files
devrandomksedgwic
authored andcommitted
testing: allow multiple SUBDAEMON items
1 parent 52d8d2c commit cd0860e

File tree

1 file changed

+11
-2
lines changed
  • contrib/pyln-testing/pyln/testing

1 file changed

+11
-2
lines changed

contrib/pyln-testing/pyln/testing/utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ def __init__(self, lightning_dir, bitcoindproxy, port=9735, random_hsm=False, no
577577
self.cmd_prefix = []
578578
self.disconnect_file = None
579579
self.lightning_dir = lightning_dir
580-
self.use_vlsd = False;
580+
self.use_vlsd = False
581581
self.vlsd_dir = os.path.join(lightning_dir, "vlsd")
582582

583583
self.rpcproxy = bitcoindproxy
@@ -598,7 +598,16 @@ def __init__(self, lightning_dir, bitcoindproxy, port=9735, random_hsm=False, no
598598
}
599599

600600
if SUBDAEMON:
601-
opts['subdaemon'] = SUBDAEMON
601+
assert node_id > 0
602+
subdaemons = SUBDAEMON.split(',')
603+
if node_id > len(subdaemons):
604+
# use the last element if not as many specifiers as nodes
605+
opts['subdaemon'] = subdaemons[-1]
606+
else:
607+
# use the matching specifier
608+
opts['subdaemon'] = subdaemons[node_id - 1]
609+
610+
print(f"starting node {node_id} with subdaemon {opts['subdaemon']}")
602611
if SUBDAEMON == 'hsmd:remote_hsmd':
603612
self.use_vlsd = True
604613

0 commit comments

Comments
 (0)