@@ -48,7 +48,6 @@ import (
4848 "github.com/lightningnetwork/lnd/lnrpc/walletrpc"
4949 "github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc"
5050 "github.com/lightningnetwork/lnd/lnrpc/wtclientrpc"
51- "github.com/lightningnetwork/lnd/lntest/wait"
5251 "github.com/lightningnetwork/lnd/lnwallet/btcwallet"
5352 "github.com/lightningnetwork/lnd/macaroons"
5453 "github.com/lightningnetwork/lnd/rpcperms"
@@ -685,6 +684,7 @@ func (g *LightningTerminal) start() error {
685684// setUpLNDClients sets up the various LND clients required by LiT.
686685func (g * LightningTerminal ) setUpLNDClients () error {
687686 var (
687+ err error
688688 insecure bool
689689 clientOptions []lndclient.BasicClientOption
690690 )
@@ -712,19 +712,28 @@ func (g *LightningTerminal) setUpLNDClients() error {
712712 // because that doesn't do anything else than just connect. We'll check
713713 // if lnd is also ready to be used in the next step.
714714 log .Infof ("Connecting basic lnd client" )
715- err := wait .NoError (func () error {
716- // Create an lnd client now that we have the full configuration.
717- // We'll need a basic client and a full client because not all
718- // subservers have the same requirements.
719- var err error
715+
716+ for {
717+ // Create an lnd client now that we have the full
718+ // configuration.
719+ // We'll need a basic client and a full client because
720+ // not all subservers have the same requirements.
720721 g .basicClient , err = lndclient .NewBasicClient (
721- host , tlsPath , filepath .Dir (macPath ), string ( network ),
722- clientOptions ... ,
722+ host , tlsPath , filepath .Dir (macPath ),
723+ string ( network ), clientOptions ... ,
723724 )
724- return err
725- }, defaultStartupTimeout )
726- if err != nil {
727- return fmt .Errorf ("could not create basic LND Client: %v" , err )
725+ if err == nil {
726+ log .Infof ("Basic lnd client connected" )
727+
728+ break
729+ }
730+
731+ g .statusMgr .SetErrored (
732+ subservers .LIT ,
733+ "Error when setting up basic LND Client: %v" , err ,
734+ )
735+
736+ log .Infof ("Retrying to connect basic lnd client" )
728737 }
729738
730739 // Now we know that the connection itself is ready. But we also need to
@@ -752,23 +761,34 @@ func (g *LightningTerminal) setUpLNDClients() error {
752761 }()
753762
754763 log .Infof ("Connecting full lnd client" )
755- g .lndClient , err = lndclient .NewLndServices (
756- & lndclient.LndServicesConfig {
757- LndAddress : host ,
758- Network : network ,
759- TLSPath : tlsPath ,
760- Insecure : insecure ,
761- CustomMacaroonPath : macPath ,
762- CustomMacaroonHex : hex .EncodeToString (macData ),
763- BlockUntilChainSynced : true ,
764- BlockUntilUnlocked : true ,
765- CallerCtx : ctxc ,
766- CheckVersion : minimalCompatibleVersion ,
767- },
768- )
769- if err != nil {
770- return fmt .Errorf ("could not create LND Services client: %v" ,
771- err )
764+ for {
765+ g .lndClient , err = lndclient .NewLndServices (
766+ & lndclient.LndServicesConfig {
767+ LndAddress : host ,
768+ Network : network ,
769+ TLSPath : tlsPath ,
770+ Insecure : insecure ,
771+ CustomMacaroonPath : macPath ,
772+ CustomMacaroonHex : hex .EncodeToString (macData ),
773+ BlockUntilChainSynced : true ,
774+ BlockUntilUnlocked : true ,
775+ CallerCtx : ctxc ,
776+ CheckVersion : minimalCompatibleVersion ,
777+ },
778+ )
779+ if err == nil {
780+ log .Infof ("Full lnd client connected" )
781+
782+ break
783+ }
784+
785+ g .statusMgr .SetErrored (
786+ subservers .LIT ,
787+ "Error when creating LND Services client: %v" ,
788+ err ,
789+ )
790+
791+ log .Infof ("Retrying to create LND Services client" )
772792 }
773793
774794 // Pass LND's build tags to the permission manager so that it can
0 commit comments