lnd+rpc: fix linter errors
This commit is contained in:
parent
35b4b35eae
commit
a8ac3cfe7d
@ -221,7 +221,7 @@ type config struct {
|
||||
|
||||
Tor *torConfig `group:"Tor" namespace:"tor"`
|
||||
|
||||
SubRpcServers *subRpcServerConfigs `group:"subrpc"`
|
||||
SubRPCServers *subRPCServerConfigs `group:"subrpc"`
|
||||
|
||||
Hodl *hodl.Config `group:"hodl" namespace:"hodl"`
|
||||
|
||||
@ -298,7 +298,7 @@ func loadConfig() (*config, error) {
|
||||
},
|
||||
MaxPendingChannels: defaultMaxPendingChannels,
|
||||
NoSeedBackup: defaultNoSeedBackup,
|
||||
SubRpcServers: &subRpcServerConfigs{
|
||||
SubRPCServers: &subRPCServerConfigs{
|
||||
SignRPC: &signrpc.Config{},
|
||||
},
|
||||
Autopilot: &autoPilotConfig{
|
||||
|
2
lnd.go
2
lnd.go
@ -315,7 +315,7 @@ func lndMain() error {
|
||||
// Initialize, and register our implementation of the gRPC interface
|
||||
// exported by the rpcServer.
|
||||
rpcServer, err := newRPCServer(
|
||||
server, macaroonService, cfg.SubRpcServers, serverOpts,
|
||||
server, macaroonService, cfg.SubRPCServers, serverOpts,
|
||||
proxyOpts, tlsConf,
|
||||
)
|
||||
if err != nil {
|
||||
|
12
rpcserver.go
12
rpcserver.go
@ -383,7 +383,7 @@ var _ lnrpc.LightningServer = (*rpcServer)(nil)
|
||||
// base level options passed to the grPC server. This typically includes things
|
||||
// like requiring TLS, etc.
|
||||
func newRPCServer(s *server, macService *macaroons.Service,
|
||||
subServerCgs *subRpcServerConfigs, serverOpts []grpc.ServerOption,
|
||||
subServerCgs *subRPCServerConfigs, serverOpts []grpc.ServerOption,
|
||||
restServerOpts []grpc.DialOption,
|
||||
tlsCfg *tls.Config) (*rpcServer, error) {
|
||||
|
||||
@ -395,7 +395,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
|
||||
// Before we create any of the sub-servers, we need to ensure that all
|
||||
// the dependencies they need are properly populated within each sub
|
||||
// server configuration struct.
|
||||
err := subServerCgs.PopulateDependancies(
|
||||
err := subServerCgs.PopulateDependencies(
|
||||
s.cc, networkDir, macService,
|
||||
)
|
||||
if err != nil {
|
||||
@ -454,7 +454,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
|
||||
// Finally, with all the pre-set up complete, we can create the main
|
||||
// gRPC server, and register the main lnrpc server along side.
|
||||
grpcServer := grpc.NewServer(serverOpts...)
|
||||
rootRpcServer := &rpcServer{
|
||||
rootRPCServer := &rpcServer{
|
||||
restServerOpts: restServerOpts,
|
||||
subServers: subServers,
|
||||
tlsCfg: tlsCfg,
|
||||
@ -462,7 +462,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
|
||||
server: s,
|
||||
quit: make(chan struct{}, 1),
|
||||
}
|
||||
lnrpc.RegisterLightningServer(grpcServer, rootRpcServer)
|
||||
lnrpc.RegisterLightningServer(grpcServer, rootRPCServer)
|
||||
|
||||
// Now the main RPC server has been registered, we'll iterate through
|
||||
// all the sub-RPC servers and register them to ensure that requests
|
||||
@ -476,7 +476,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
|
||||
}
|
||||
}
|
||||
|
||||
return rootRpcServer, nil
|
||||
return rootRPCServer, nil
|
||||
}
|
||||
|
||||
// Start launches any helper goroutines required for the rpcServer to function.
|
||||
@ -572,6 +572,8 @@ func (r *rpcServer) Stop() error {
|
||||
subServer.Name())
|
||||
|
||||
if err := subServer.Stop(); err != nil {
|
||||
rpcsLog.Errorf("unable to stop sub-server %v: %v",
|
||||
subServer.Name(), err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -8,25 +8,25 @@ import (
|
||||
"github.com/lightningnetwork/lnd/macaroons"
|
||||
)
|
||||
|
||||
// subRpcServerConfigs is special sub-config in the main configuration that
|
||||
// subRPCServerConfigs is special sub-config in the main configuration that
|
||||
// houses the configuration for the optional sub-servers. These sub-RPC servers
|
||||
// are meant to house experimental new features that may eventually make it
|
||||
// into the main RPC server that lnd exposes. Special methods are present on
|
||||
// this struct to allow the main RPC server to create and manipulate the
|
||||
// sub-RPC servers in a generalized manner.
|
||||
type subRpcServerConfigs struct {
|
||||
type subRPCServerConfigs struct {
|
||||
// SignRPC is a sub-RPC server that exposes signing of arbitrary inputs
|
||||
// as a gRPC service.
|
||||
SignRPC *signrpc.Config `group:"signrpc" namespace:"signrpc"`
|
||||
}
|
||||
|
||||
// PopulateDependancies attempts to iterate through all the sub-server configs
|
||||
// PopulateDependencies attempts to iterate through all the sub-server configs
|
||||
// within this struct, and populate the items it requires based on the main
|
||||
// configuration file, and the chain control.
|
||||
//
|
||||
// NOTE: This MUST be called before any callers are permitted to execute the
|
||||
// FetchConfig method.
|
||||
func (s *subRpcServerConfigs) PopulateDependancies(cc *chainControl,
|
||||
func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
|
||||
networkDir string, macService *macaroons.Service) error {
|
||||
|
||||
// First, we'll use reflect to obtain a version of the config struct
|
||||
@ -80,7 +80,7 @@ func (s *subRpcServerConfigs) PopulateDependancies(cc *chainControl,
|
||||
// subServerName name, then false will be returned for the second parameter.
|
||||
//
|
||||
// NOTE: Part of the lnrpc.SubServerConfigDispatcher interface.
|
||||
func (s *subRpcServerConfigs) FetchConfig(subServerName string) (interface{}, bool) {
|
||||
func (s *subRPCServerConfigs) FetchConfig(subServerName string) (interface{}, bool) {
|
||||
// First, we'll use reflect to obtain a version of the config struct
|
||||
// that allows us to programmatically inspect its fields.
|
||||
selfVal := extractReflectValue(s)
|
||||
|
Loading…
Reference in New Issue
Block a user