Skip to content

Commit d777a11

Browse files
devrandomksedgwic
authored andcommitted
replace vlsd support with vlsd2
1 parent be61a5a commit d777a11

File tree

1 file changed

+34
-37
lines changed
  • contrib/pyln-testing/pyln/testing

1 file changed

+34
-37
lines changed

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

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -607,21 +607,17 @@ def getnewaddress(self):
607607
class ValidatingLightningSignerD(TailableProc):
608608
def __init__(self, vlsd_dir, vlsd_port, node_id, network):
609609
TailableProc.__init__(self, vlsd_dir, verbose=True)
610-
self.executable = env("REMOTE_SIGNER_CMD", 'vlsd')
610+
self.executable = env("REMOTE_SIGNER_CMD", 'vlsd2')
611+
os.environ['ALLOWLIST'] = env(
612+
'REMOTE_SIGNER_ALLOWLIST',
613+
'contrib/remote_hsmd/TESTING_ALLOWLIST')
611614
self.opts = [
612-
'--log-level-console=DEBUG',
613-
'--log-level-disk=DEBUG',
614615
'--network={}'.format(network),
615616
'--datadir={}'.format(vlsd_dir),
616-
'--port={}'.format(vlsd_port),
617-
'--initial-allowlist-file={}'.format(env('REMOTE_SIGNER_ALLOWLIST',
618-
'contrib/remote_hsmd/TESTING_ALLOWLIST')),
619-
'--bitcoin=http://{}:{}@127.0.0.1:{}'.format(
620-
BITCOIND_CONFIG['rpcuser'],
621-
BITCOIND_CONFIG['rpcpassword'],
622-
BITCOIND_CONFIG['rpcport']),
623-
]
624-
self.prefix = 'vlsd-%d' % (node_id)
617+
'--connect=http://localhost:{}'.format(vlsd_port),
618+
'--integration-test',
619+
]
620+
self.prefix = 'vlsd2-%d' % (node_id)
625621
self.vlsd_port = vlsd_port
626622

627623
@property
@@ -632,13 +628,13 @@ def start(self, stdin=None, stdout_redir=True, stderr_redir=True,
632628
wait_for_initialized=True):
633629
TailableProc.start(self, stdin, stdout_redir, stderr_redir)
634630
# We need to always wait for initialization
635-
self.wait_for_log("vlsd [0-9]* ready on .*:{}".format(self.vlsd_port))
636-
logging.info("vlsd started")
631+
self.wait_for_log("vlsd2 git_desc")
632+
logging.info("vlsd2 started")
637633

638634
def stop(self, timeout=10):
639-
logging.info("stopping vlsd")
635+
logging.info("stopping vlsd2")
640636
rc = TailableProc.stop(self, timeout)
641-
logging.info("vlsd stopped")
637+
logging.info("vlsd2 stopped")
642638
self.logs_catchup()
643639
return rc
644640

@@ -711,7 +707,7 @@ def __init__(
711707
opts['subdaemon'] = subdaemons[ndx - 1]
712708

713709
print(f"starting node {node_id} with subdaemon {opts['subdaemon']}")
714-
if SUBDAEMON == 'hsmd:remote_hsmd':
710+
if SUBDAEMON == 'hsmd:remote_hsmd_socket':
715711
self.use_vlsd = True
716712

717713
for k, v in opts.items():
@@ -741,9 +737,8 @@ def __init__(
741737

742738
def cleanup(self):
743739
if self.use_vlsd:
744-
if self.use_vlsd:
745-
# Make sure the remotesigner is shutdown
746-
self.vlsd.stop()
740+
# Make sure the remotesigner is shutdown
741+
self.vlsd.stop()
747742

748743
# To force blackhole to exit, disconnect file must be truncated!
749744
if self.disconnect_file:
@@ -771,23 +766,6 @@ def __del__(self):
771766

772767
def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
773768
try:
774-
if self.use_vlsd:
775-
# Kill any previous vlsd (we may have been restarted)
776-
if self.vlsd is not None:
777-
logging.info("killing prior vlsd")
778-
self.vlsd.kill()
779-
780-
# Start the remote signer first
781-
self.vlsd_port = reserve_unused_port()
782-
self.vlsd = ValidatingLightningSignerD(
783-
self.vlsd_dir, self.vlsd_port, self.node_id, self.opts['network'])
784-
self.vlsd.start(
785-
stdin, stdout_redir=True, stderr_redir=True,
786-
wait_for_initialized=wait_for_initialized)
787-
788-
# We can't do this in the constructor because we need a new port on each restart.
789-
self.env['REMOTE_HSMD_ENDPOINT'] = '127.0.0.1:{}'.format(self.vlsd_port)
790-
791769
self.env['VLS_LSS'] = f"http://localhost:{self.lssd_port}"
792770
self.env['RUST_LOG'] = 'debug'
793771
# Some of the remote hsmd proxies need a bitcoind RPC connection
@@ -801,7 +779,26 @@ def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
801779
self.env['VLS_NETWORK'] = self.opts['network']
802780

803781
self.opts['bitcoin-rpcport'] = self.rpcproxy.rpcport
782+
783+
if self.use_vlsd:
784+
self.vlsd_port = reserve_unused_port()
785+
# We can't do this in the constructor because we need a new port on each restart.
786+
self.env['VLS_PORT'] = str(self.vlsd_port)
787+
# Kill any previous vlsd (we may have been restarted)
788+
if self.vlsd is not None:
789+
logging.info("killing prior vlsd")
790+
self.vlsd.kill()
791+
804792
TailableProc.start(self, stdin, stdout_redir=False, stderr_redir=stderr_redir)
793+
794+
if self.use_vlsd:
795+
# Start the remote signer first
796+
self.vlsd = ValidatingLightningSignerD(
797+
self.vlsd_dir, self.vlsd_port, self.node_id, self.opts['network'])
798+
self.vlsd.start(
799+
stdin, stdout_redir=True, stderr_redir=True,
800+
wait_for_initialized=wait_for_initialized)
801+
805802
if wait_for_initialized:
806803
self.wait_for_log("Server started with public key")
807804
logging.info("LightningD started")

0 commit comments

Comments
 (0)