@@ -130,7 +130,7 @@ func (p *rpcProxy) Start() error {
130130
131131 // Setup the connection to lnd.
132132 host , _ , tlsPath , _ := p .cfg .lndConnectParams ()
133- p .lndConn , err = dialLnd ( host , tlsPath )
133+ p .lndConn , err = dialBackend ( "lnd" , host , tlsPath )
134134 if err != nil {
135135 return fmt .Errorf ("could not dial lnd: %v" , err )
136136 }
@@ -336,21 +336,20 @@ func (p *rpcProxy) basicAuthToMacaroon(ctx context.Context,
336336 return metadata .NewIncomingContext (ctx , md ), nil
337337}
338338
339- // dialLnd connects to lnd through the given address and uses the given TLS
340- // certificate to authenticate the connection.
341- func dialLnd (dialAddr , tlsCertPath string ) (* grpc.ClientConn , error ) {
342-
339+ // dialBackend connects to a gRPC backend through the given address and uses the
340+ // given TLS certificate to authenticate the connection.
341+ func dialBackend (name , dialAddr , tlsCertPath string ) (* grpc.ClientConn , error ) {
343342 var opts []grpc.DialOption
344343 tlsConfig , err := credentials .NewClientTLSFromFile (tlsCertPath , "" )
345344 if err != nil {
346- return nil , fmt .Errorf ("could not read lnd TLS cert %s: %v" ,
347- tlsCertPath , err )
345+ return nil , fmt .Errorf ("could not read %s TLS cert %s: %v" ,
346+ name , tlsCertPath , err )
348347 }
349348
350349 opts = append (
351350 opts ,
352351
353- // From the grpxProxy doc: This codec is *crucial* to the
352+ // From the grpcProxy doc: This codec is *crucial* to the
354353 // functioning of the proxy.
355354 grpc .WithCodec (grpcProxy .Codec ()), // nolint
356355 grpc .WithTransportCredentials (tlsConfig ),
@@ -361,10 +360,11 @@ func dialLnd(dialAddr, tlsCertPath string) (*grpc.ClientConn, error) {
361360 }),
362361 )
363362
364- log .Infof ("Dialing lnd gRPC server at %s" , dialAddr )
363+ log .Infof ("Dialing %s gRPC server at %s" , name , dialAddr )
365364 cc , err := grpc .Dial (dialAddr , opts ... )
366365 if err != nil {
367- return nil , fmt .Errorf ("failed dialing backend: %v" , err )
366+ return nil , fmt .Errorf ("failed dialing %s backend: %v" , name ,
367+ err )
368368 }
369369 return cc , nil
370370}
0 commit comments