@@ -238,8 +238,24 @@ func (g *LightningTerminal) Run() error {
238
238
return fmt .Errorf ("could not create permissions manager" )
239
239
}
240
240
241
+ // The litcli status command will call the "/lnrpc.State/GetState" RPC.
242
+ // As the status command is available to the user before the macaroons
243
+ // have been loaded/created, and before the lnd clients have been
244
+ // set up, we need to override the isReady check for this specific
245
+ // URI as soon as LND can accept the call, i.e. when the lnd sub-server
246
+ // is in the "Wallet Ready" state.
247
+ lndOverride := func (uri , manualStatus string ) (bool , bool ) {
248
+ if uri != "/lnrpc.State/GetState" {
249
+ return false , false
250
+ }
251
+
252
+ return manualStatus == lndWalletReadyStatus , true
253
+ }
254
+
241
255
// Register LND, LiT and Accounts with the status manager.
242
- g .statusMgr .RegisterAndEnableSubServer (subservers .LND )
256
+ g .statusMgr .RegisterAndEnableSubServer (
257
+ subservers .LND , status .WithIsReadyOverride (lndOverride ),
258
+ )
243
259
g .statusMgr .RegisterAndEnableSubServer (subservers .LIT )
244
260
g .statusMgr .RegisterSubServer (subservers .ACCOUNTS )
245
261
@@ -556,6 +572,9 @@ func (g *LightningTerminal) start() error {
556
572
557
573
// We now set a custom status for the LND sub-server to indicate that
558
574
// the wallet is ready.
575
+ // This is done _before_ we have set up the lnd clients so that the
576
+ // litcli status command won't error before the lnd sub-server has
577
+ // been marked as running.
559
578
g .statusMgr .SetCustomStatus (subservers .LND , lndWalletReadyStatus )
560
579
561
580
// Now that we have started the main UI web server, show some useful
0 commit comments