diff --git a/lnd.go b/lnd.go index f51181195..77456fa15 100644 --- a/lnd.go +++ b/lnd.go @@ -379,7 +379,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg, // wildcard to prevent certificate issues when accessing the proxy // externally. stopProxy, err := startRestProxy( - cfg, rpcServer, restDialOpts, restListen, + ctx, cfg, rpcServer, restDialOpts, restListen, ) if err != nil { return mkErr("error starting REST proxy: %v", err) @@ -921,7 +921,8 @@ func startGrpcListen(cfg *Config, grpcServer *grpc.Server, // startRestProxy starts the given REST proxy on the listeners found in the // config. -func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialOption, +func startRestProxy(ctx context.Context, cfg *Config, rpcServer *rpcServer, + restDialOpts []grpc.DialOption, restListen func(net.Addr) (net.Listener, error)) (func(), error) { // We use the first RPC listener as the destination for our REST proxy. @@ -948,7 +949,6 @@ func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialO } // Start a REST proxy for our gRPC server. - ctx := context.Background() ctx, cancel := context.WithCancel(ctx) shutdownFuncs = append(shutdownFuncs, cancel)