Skip to content

Commit 3d43572

Browse files
terminal: add a lnd Wallet Ready state
1 parent 4a46e41 commit 3d43572

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

terminal.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ const (
6666
MainnetServer = "autopilot.lightning.finance:12010"
6767
TestnetServer = "test.autopilot.lightning.finance:12010"
6868

69+
// lndWalletReadyStatus is a custom status that will be used with the
70+
// LND subserver. If the subserver is in this state then it will allow
71+
// certain wallet calls through while denying other calls that require
72+
// LND to be fully started.
73+
lndWalletReadyStatus = "Wallet Ready"
74+
6975
defaultServerTimeout = 10 * time.Second
7076
defaultConnectTimeout = 15 * time.Second
7177
defaultStartupTimeout = 5 * time.Second
@@ -548,10 +554,9 @@ func (g *LightningTerminal) start() error {
548554
err)
549555
}
550556

551-
// We can now set the status of LND as running.
552-
// This is done _before_ we wait for the macaroon so that
553-
// LND commands to create and unlock a wallet can be allowed.
554-
g.statusMgr.SetRunning(subservers.LND)
557+
// We now set a custom status for the LND sub-server to indicate that
558+
// the wallet is ready.
559+
g.statusMgr.SetCustomStatus(subservers.LND, lndWalletReadyStatus)
555560

556561
// Now that we have started the main UI web server, show some useful
557562
// information to the user so they can access the web UI easily.
@@ -619,6 +624,10 @@ func (g *LightningTerminal) start() error {
619624
return fmt.Errorf("could not start LND")
620625
}
621626

627+
// Mark that lnd is now completely running after connecting the
628+
// lnd clients.
629+
g.statusMgr.SetRunning(subservers.LND)
630+
622631
// If we're in integrated and stateless init mode, we won't create
623632
// macaroon files in any of the subserver daemons.
624633
createDefaultMacaroons := true

0 commit comments

Comments
 (0)