Skip to content

Commit dc51e88

Browse files
committed
terminal: register Proxy server with Lit's grpc server
We eventually want a few Lit grpc servers to continue functioning even if LND did not start up properly. This means that we need to register these servers with LiT's grpc server instead of using LND's. Because of this change, we also need to update the itest a bit so that calls to the proxy server are never expected to succeed if the call is made via the LND port.
1 parent 8db75cf commit dc51e88

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

itest/litd_mode_integrated_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ var (
217217

218218
// noAuth is true if the call does not require a macaroon.
219219
noAuth bool
220+
221+
// litOnly is true if the endpoint is only being served on
222+
// Lit's grpc server and so will never be accessible via the
223+
// LND port.
224+
litOnly bool
220225
}{{
221226
name: "lnrpc",
222227
macaroonFn: lndMacaroonFn,
@@ -332,6 +337,7 @@ var (
332337
allowedThroughLNC: false,
333338
grpcWebURI: "/litrpc.Proxy/GetInfo",
334339
restWebURI: "/v1/proxy/info",
340+
litOnly: true,
335341
}}
336342

337343
// customURIs is a map of endpoint URIs that we want to allow via a
@@ -457,7 +463,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
457463
endpoint.noAuth,
458464
endpoint.requestFn,
459465
endpoint.successPattern,
460-
endpointDisabled,
466+
endpointDisabled || endpoint.litOnly,
461467
"Unimplemented desc = unknown service",
462468
)
463469
})
@@ -490,7 +496,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
490496
cfg.UIPassword, endpoint.requestFn,
491497
endpoint.noAuth,
492498
true, endpoint.successPattern,
493-
endpointDisabled,
499+
endpointDisabled || endpoint.litOnly,
494500
"Unimplemented desc = unknown service",
495501
)
496502
})
@@ -560,7 +566,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,
560566
superMacFile, endpoint.noAuth,
561567
endpoint.requestFn,
562568
endpoint.successPattern,
563-
endpointDisabled,
569+
endpointDisabled || endpoint.litOnly,
564570
"Unimplemented desc = unknown service",
565571
)
566572
})

terminal.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ func (g *LightningTerminal) Run() error {
242242
g.cfg, g, g.validateSuperMacaroon, g.permsMgr, g.subServerMgr,
243243
)
244244

245+
// Register any gRPC services that should be served using LiT's
246+
// gRPC server regardless of the LND mode being used.
247+
litrpc.RegisterProxyServer(g.rpcProxy.grpcServer, g.rpcProxy)
248+
245249
// Start the main web server that dispatches requests either to the
246250
// static UI file server or the RPC proxy. This makes it possible to
247251
// unlock lnd through the UI.
@@ -915,7 +919,6 @@ func (g *LightningTerminal) registerSubDaemonGrpcServers(server *grpc.Server,
915919
if withLitRPC {
916920
litrpc.RegisterSessionsServer(server, g.sessionRpcServer)
917921
litrpc.RegisterAccountsServer(server, g.accountRpcServer)
918-
litrpc.RegisterProxyServer(server, g.rpcProxy)
919922
}
920923

921924
litrpc.RegisterFirewallServer(server, g.sessionRpcServer)

0 commit comments

Comments
 (0)