Skip to content

Commit 24957e9

Browse files
committed
Allow selection of serial demo node with VLS_SERIAL_SELECT
1 parent f70fbbb commit 24957e9

File tree

1 file changed

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

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,20 @@ def __init__(
662662
if SUBDAEMON:
663663
assert node_id > 0
664664
subdaemons = SUBDAEMON.split(',')
665-
if node_id > len(subdaemons):
665+
# VLS_SERIAL_SELECT "swaps" the selected item with the first item
666+
select = env("VLS_SERIAL_SELECT", '1')
667+
if node_id == int(select):
668+
ndx = 1
669+
elif node_id == 1:
670+
ndx = int(select)
671+
else:
672+
ndx = node_id
673+
if ndx > len(subdaemons):
666674
# use the last element if not as many specifiers as nodes
667675
opts['subdaemon'] = subdaemons[-1]
668676
else:
669677
# use the matching specifier
670-
opts['subdaemon'] = subdaemons[node_id - 1]
678+
opts['subdaemon'] = subdaemons[ndx - 1]
671679

672680
print(f"starting node {node_id} with subdaemon {opts['subdaemon']}")
673681
if SUBDAEMON == 'hsmd:remote_hsmd':

0 commit comments

Comments
 (0)