Skip to content

Commit 33e3ef5

Browse files
committed
terminal: register integrated daemon gRPC server to proxy
It turns out we never implemented the proxying of the daemon gRPC requests as drawn in the ASCII diagram. We used to hook up the daemon gRPC servers to the instance we got back from lnd. The requests needed to be forwarded internally to lnd's gRPC listener even though they'd be processed by the external subservers later. We can short-circuit that whole redirection by simply hooking the daemon gRPC servers directly into the proxy's gRPC server instance. This also fixes the issue that Faraday, Loop and Pool requests wouldn't work anymore in integrated mode after the recent changes in the proxy logic.
1 parent 2c4b6c8 commit 33e3ef5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

terminal.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type LightningTerminal struct {
6161
lndErrChan chan error
6262

6363
lndClient *lndclient.GrpcLndServices
64-
lndGrpcServer *grpc.Server
6564

6665
faradayServer *frdrpc.RPCServer
6766
faradayStarted bool
@@ -343,23 +342,27 @@ func (g *LightningTerminal) startSubservers() error {
343342
// called once lnd has initialized its main gRPC server instance. It gives the
344343
// daemons (or external subservers) the possibility to register themselves to
345344
// the same server instance.
346-
func (g *LightningTerminal) RegisterGrpcSubserver(grpcServer *grpc.Server) error {
347-
g.lndGrpcServer = grpcServer
348-
345+
func (g *LightningTerminal) RegisterGrpcSubserver(_ *grpc.Server) error {
349346
// In remote mode the "director" of the RPC proxy will act as a catch-
350347
// all for any gRPC request that isn't known because we didn't register
351348
// any server for it. The director will then forward the request to the
352349
// remote service.
353350
if !g.cfg.faradayRemote {
354-
frdrpc.RegisterFaradayServerServer(grpcServer, g.faradayServer)
351+
frdrpc.RegisterFaradayServerServer(
352+
g.rpcProxy.grpcServer, g.faradayServer,
353+
)
355354
}
356355

357356
if !g.cfg.loopRemote {
358-
looprpc.RegisterSwapClientServer(grpcServer, g.loopServer)
357+
looprpc.RegisterSwapClientServer(
358+
g.rpcProxy.grpcServer, g.loopServer,
359+
)
359360
}
360361

361362
if !g.cfg.poolRemote {
362-
poolrpc.RegisterTraderServer(grpcServer, g.poolServer)
363+
poolrpc.RegisterTraderServer(
364+
g.rpcProxy.grpcServer, g.poolServer,
365+
)
363366
}
364367

365368
return nil

0 commit comments

Comments
 (0)