Skip to content

Commit d9ccb6e

Browse files
devrandomksedgwic
authored andcommitted
replace vlsd support with vlsd2
1 parent 4c40650 commit d9ccb6e

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
@@ -621,21 +621,17 @@ def getnewaddress(self):
621621
class ValidatingLightningSignerD(TailableProc):
622622
def __init__(self, vlsd_dir, vlsd_port, node_id, network):
623623
TailableProc.__init__(self, vlsd_dir, verbose=True)
624-
self.executable = env("REMOTE_SIGNER_CMD", 'vlsd')
624+
self.executable = env("REMOTE_SIGNER_CMD", 'vlsd2')
625+
os.environ['ALLOWLIST'] = env(
626+
'REMOTE_SIGNER_ALLOWLIST',
627+
'contrib/remote_hsmd/TESTING_ALLOWLIST')
625628
self.opts = [
626-
'--log-level-console=DEBUG',
627-
'--log-level-disk=DEBUG',
628629
'--network={}'.format(network),
629630
'--datadir={}'.format(vlsd_dir),
630-
'--port={}'.format(vlsd_port),
631-
'--initial-allowlist-file={}'.format(env('REMOTE_SIGNER_ALLOWLIST',
632-
'contrib/remote_hsmd/TESTING_ALLOWLIST')),
633-
'--bitcoin=http://{}:{}@127.0.0.1:{}'.format(
634-
BITCOIND_CONFIG['rpcuser'],
635-
BITCOIND_CONFIG['rpcpassword'],
636-
BITCOIND_CONFIG['rpcport']),
637-
]
638-
self.prefix = 'vlsd-%d' % (node_id)
631+
'--connect=http://localhost:{}'.format(vlsd_port),
632+
'--integration-test',
633+
]
634+
self.prefix = 'vlsd2-%d' % (node_id)
639635
self.vlsd_port = vlsd_port
640636

641637
@property
@@ -646,13 +642,13 @@ def start(self, stdin=None, stdout_redir=True, stderr_redir=True,
646642
wait_for_initialized=True):
647643
TailableProc.start(self, stdin, stdout_redir, stderr_redir)
648644
# We need to always wait for initialization
649-
self.wait_for_log("vlsd [0-9]* ready on .*:{}".format(self.vlsd_port))
650-
logging.info("vlsd started")
645+
self.wait_for_log("vlsd2 git_desc")
646+
logging.info("vlsd2 started")
651647

652648
def stop(self, timeout=10):
653-
logging.info("stopping vlsd")
649+
logging.info("stopping vlsd2")
654650
rc = TailableProc.stop(self, timeout)
655-
logging.info("vlsd stopped")
651+
logging.info("vlsd2 stopped")
656652
self.logs_catchup()
657653
return rc
658654

@@ -724,7 +720,7 @@ def __init__(
724720
opts['subdaemon'] = subdaemons[ndx - 1]
725721

726722
print(f"starting node {node_id} with subdaemon {opts['subdaemon']}")
727-
if SUBDAEMON == 'hsmd:remote_hsmd':
723+
if SUBDAEMON == 'hsmd:remote_hsmd_socket':
728724
self.use_vlsd = True
729725

730726
for k, v in opts.items():
@@ -753,9 +749,8 @@ def __init__(
753749

754750
def cleanup(self):
755751
if self.use_vlsd:
756-
if self.use_vlsd:
757-
# Make sure the remotesigner is shutdown
758-
self.vlsd.stop()
752+
# Make sure the remotesigner is shutdown
753+
self.vlsd.stop()
759754

760755
# To force blackhole to exit, disconnect file must be truncated!
761756
if 'dev-disconnect' in self.opts:
@@ -783,23 +778,6 @@ def __del__(self):
783778

784779
def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
785780
try:
786-
if self.use_vlsd:
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-
792-
# Start the remote signer first
793-
self.vlsd_port = reserve_unused_port()
794-
self.vlsd = ValidatingLightningSignerD(
795-
self.vlsd_dir, self.vlsd_port, self.node_id, self.opts['network'])
796-
self.vlsd.start(
797-
stdin, stdout_redir=True, stderr_redir=True,
798-
wait_for_initialized=wait_for_initialized)
799-
800-
# We can't do this in the constructor because we need a new port on each restart.
801-
self.env['REMOTE_HSMD_ENDPOINT'] = '127.0.0.1:{}'.format(self.vlsd_port)
802-
803781
self.env['VLS_LSS'] = f"http://localhost:{self.lssd_port}"
804782
self.env['RUST_LOG'] = 'debug'
805783
# Some of the remote hsmd proxies need a bitcoind RPC connection
@@ -813,7 +791,26 @@ def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
813791
self.env['VLS_NETWORK'] = self.opts['network']
814792

815793
self.opts['bitcoin-rpcport'] = self.rpcproxy.rpcport
794+
795+
if self.use_vlsd:
796+
self.vlsd_port = reserve_unused_port()
797+
# We can't do this in the constructor because we need a new port on each restart.
798+
self.env['VLS_PORT'] = str(self.vlsd_port)
799+
# Kill any previous vlsd (we may have been restarted)
800+
if self.vlsd is not None:
801+
logging.info("killing prior vlsd")
802+
self.vlsd.kill()
803+
816804
TailableProc.start(self, stdin, stdout_redir=False, stderr_redir=stderr_redir)
805+
806+
if self.use_vlsd:
807+
# Start the remote signer first
808+
self.vlsd = ValidatingLightningSignerD(
809+
self.vlsd_dir, self.vlsd_port, self.node_id, self.opts['network'])
810+
self.vlsd.start(
811+
stdin, stdout_redir=True, stderr_redir=True,
812+
wait_for_initialized=wait_for_initialized)
813+
817814
if wait_for_initialized:
818815
self.wait_for_log("Server started with public key")
819816
logging.info("LightningD started")

0 commit comments

Comments
 (0)