Skip to content

Commit 744dd3a

Browse files
committed
lit: make the basicClient available to the rpcProxy
1 parent b12d226 commit 744dd3a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

rpc_proxy.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
litstatus "github.com/lightninglabs/lightning-terminal/status"
1919
"github.com/lightninglabs/lightning-terminal/subservers"
2020
"github.com/lightningnetwork/lnd/lncfg"
21+
"github.com/lightningnetwork/lnd/lnrpc"
2122
"github.com/lightningnetwork/lnd/macaroons"
2223
grpcProxy "github.com/mwitkow/grpc-proxy/proxy"
2324
"google.golang.org/grpc"
@@ -179,6 +180,10 @@ type rpcProxy struct {
179180

180181
lndConn *grpc.ClientConn
181182

183+
// basicClient is an interface to an LND node. Note that this may be nil
184+
// until it is set via setBasicLNDClient.
185+
basicClient lnrpc.LightningClient
186+
182187
grpcServer *grpc.Server
183188
grpcWebProxy *grpcweb.WrappedGrpcServer
184189
}
@@ -211,6 +216,12 @@ func (p *rpcProxy) Stop() error {
211216
return nil
212217
}
213218

219+
// setBasicLNDClient provides the rpcProxy with a connection to LND
220+
// implementing the lnrpc.LightningClient interface.
221+
func (p *rpcProxy) setBasicLNDClient(client lnrpc.LightningClient) {
222+
p.basicClient = client
223+
}
224+
214225
// StopDaemon will send a shutdown request to the interrupt handler, triggering
215226
// a graceful shutdown of the daemon.
216227
//

terminal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error {
805805

806806
log.Infof("Retrying to connect basic lnd client")
807807
}
808+
g.rpcProxy.setBasicLNDClient(g.basicClient)
808809

809810
// Now we know that the connection itself is ready. But we also need to
810811
// wait for two things: The chain notifier to be ready and the lnd

0 commit comments

Comments
 (0)