@@ -622,21 +622,17 @@ def getnewaddress(self):
622622class ValidatingLightningSignerD (TailableProc ):
623623 def __init__ (self , vlsd_dir , vlsd_port , node_id , network ):
624624 TailableProc .__init__ (self , vlsd_dir , verbose = True )
625- self .executable = env ("REMOTE_SIGNER_CMD" , 'vlsd' )
625+ self .executable = env ("REMOTE_SIGNER_CMD" , 'vlsd2' )
626+ os .environ ['ALLOWLIST' ] = env (
627+ 'REMOTE_SIGNER_ALLOWLIST' ,
628+ 'contrib/remote_hsmd/TESTING_ALLOWLIST' )
626629 self .opts = [
627- '--log-level-console=DEBUG' ,
628- '--log-level-disk=DEBUG' ,
629630 '--network={}' .format (network ),
630631 '--datadir={}' .format (vlsd_dir ),
631- '--port={}' .format (vlsd_port ),
632- '--initial-allowlist-file={}' .format (env ('REMOTE_SIGNER_ALLOWLIST' ,
633- 'contrib/remote_hsmd/TESTING_ALLOWLIST' )),
634- '--bitcoin=http://{}:{}@127.0.0.1:{}' .format (
635- BITCOIND_CONFIG ['rpcuser' ],
636- BITCOIND_CONFIG ['rpcpassword' ],
637- BITCOIND_CONFIG ['rpcport' ]),
638- ]
639- self .prefix = 'vlsd-%d' % (node_id )
632+ '--connect=http://localhost:{}' .format (vlsd_port ),
633+ '--integration-test' ,
634+ ]
635+ self .prefix = 'vlsd2-%d' % (node_id )
640636 self .vlsd_port = vlsd_port
641637
642638 @property
@@ -647,13 +643,13 @@ def start(self, stdin=None, stdout_redir=True, stderr_redir=True,
647643 wait_for_initialized = True ):
648644 TailableProc .start (self , stdin , stdout_redir , stderr_redir )
649645 # We need to always wait for initialization
650- self .wait_for_log ("vlsd [0-9]* ready on .*:{}" . format ( self . vlsd_port ) )
651- logging .info ("vlsd started" )
646+ self .wait_for_log ("vlsd2 git_desc" )
647+ logging .info ("vlsd2 started" )
652648
653649 def stop (self , timeout = 10 ):
654- logging .info ("stopping vlsd " )
650+ logging .info ("stopping vlsd2 " )
655651 rc = TailableProc .stop (self , timeout )
656- logging .info ("vlsd stopped" )
652+ logging .info ("vlsd2 stopped" )
657653 self .logs_catchup ()
658654 return rc
659655
@@ -726,7 +722,7 @@ def __init__(
726722 opts ['subdaemon' ] = subdaemons [ndx - 1 ]
727723
728724 print (f"starting node { node_id } with subdaemon { opts ['subdaemon' ]} " )
729- if SUBDAEMON == 'hsmd:remote_hsmd ' :
725+ if SUBDAEMON == 'hsmd:remote_hsmd_socket ' :
730726 self .use_vlsd = True
731727
732728 for k , v in opts .items ():
@@ -756,9 +752,8 @@ def __init__(
756752
757753 def cleanup (self ):
758754 if self .use_vlsd :
759- if self .use_vlsd :
760- # Make sure the remotesigner is shutdown
761- self .vlsd .stop ()
755+ # Make sure the remotesigner is shutdown
756+ self .vlsd .stop ()
762757
763758 # To force blackhole to exit, disconnect file must be truncated!
764759 if self .disconnect_file :
@@ -786,23 +781,6 @@ def __del__(self):
786781
787782 def start (self , stdin = None , wait_for_initialized = True , stderr_redir = False ):
788783 try :
789- if self .use_vlsd :
790- # Kill any previous vlsd (we may have been restarted)
791- if self .vlsd is not None :
792- logging .info ("killing prior vlsd" )
793- self .vlsd .kill ()
794-
795- # Start the remote signer first
796- self .vlsd_port = reserve_unused_port ()
797- self .vlsd = ValidatingLightningSignerD (
798- self .vlsd_dir , self .vlsd_port , self .node_id , self .opts ['network' ])
799- self .vlsd .start (
800- stdin , stdout_redir = True , stderr_redir = True ,
801- wait_for_initialized = wait_for_initialized )
802-
803- # We can't do this in the constructor because we need a new port on each restart.
804- self .env ['REMOTE_HSMD_ENDPOINT' ] = '127.0.0.1:{}' .format (self .vlsd_port )
805-
806784 self .env ['VLS_LSS' ] = f"http://localhost:{ self .lssd_port } "
807785 self .env ['RUST_LOG' ] = 'debug'
808786 # Some of the remote hsmd proxies need a bitcoind RPC connection
@@ -816,7 +794,26 @@ def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
816794 self .env ['VLS_NETWORK' ] = self .opts ['network' ]
817795
818796 self .opts ['bitcoin-rpcport' ] = self .rpcproxy .rpcport
797+
798+ if self .use_vlsd :
799+ self .vlsd_port = reserve_unused_port ()
800+ # We can't do this in the constructor because we need a new port on each restart.
801+ self .env ['VLS_PORT' ] = str (self .vlsd_port )
802+ # Kill any previous vlsd (we may have been restarted)
803+ if self .vlsd is not None :
804+ logging .info ("killing prior vlsd" )
805+ self .vlsd .kill ()
806+
819807 TailableProc .start (self , stdin , stdout_redir = False , stderr_redir = stderr_redir )
808+
809+ if self .use_vlsd :
810+ # Start the remote signer first
811+ self .vlsd = ValidatingLightningSignerD (
812+ self .vlsd_dir , self .vlsd_port , self .node_id , self .opts ['network' ])
813+ self .vlsd .start (
814+ stdin , stdout_redir = True , stderr_redir = True ,
815+ wait_for_initialized = wait_for_initialized )
816+
820817 if wait_for_initialized :
821818 self .wait_for_log ("Server started with public key" )
822819 logging .info ("LightningD started" )
0 commit comments