diff --git a/lnrpc/walletrpc/config_active.go b/lnrpc/walletrpc/config_active.go index f285f75d6..891553fd8 100644 --- a/lnrpc/walletrpc/config_active.go +++ b/lnrpc/walletrpc/config_active.go @@ -11,6 +11,13 @@ import ( "github.com/lightningnetwork/lnd/sweep" ) +const ( + // SubServerName is the name of the sub rpc server. We'll use this name + // to register ourselves, and we also require that the main + // SubServerConfigDispatcher instance recognize as the name of our + SubServerName = "WalletKitRPC" +) + // Config is the primary configuration struct for the WalletKit RPC server. It // contains all the items required for the signer rpc server to carry out its // duties. The fields with struct tags are meant to be parsed as normal diff --git a/lnrpc/walletrpc/config_default.go b/lnrpc/walletrpc/config_default.go index 16bbbcc88..9439ef840 100644 --- a/lnrpc/walletrpc/config_default.go +++ b/lnrpc/walletrpc/config_default.go @@ -2,6 +2,13 @@ package walletrpc +const ( + // SubServerName is the name of the sub rpc server. We'll use this name + // to register ourselves, and we also require that the main + // SubServerConfigDispatcher instance recognize as the name of our + SubServerName = "WalletKitRPC" +) + // Config is the primary configuration struct for the WalletKit RPC server. // When the server isn't active (via the build flag), callers outside this // package will see this shell of a config file. diff --git a/lnrpc/walletrpc/driver.go b/lnrpc/walletrpc/driver.go index 649445a26..d8547d8c0 100644 --- a/lnrpc/walletrpc/driver.go +++ b/lnrpc/walletrpc/driver.go @@ -16,13 +16,13 @@ func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) ( *WalletKit, lnrpc.MacaroonPerms, error) { // We'll attempt to look up the config that we expect, according to our - // subServerName name. If we can't find this, then we'll exit with an + // SubServerName name. If we can't find this, then we'll exit with an // error, as we're unable to properly initialize ourselves without this // config. - walletKitServerConf, ok := configRegistry.FetchConfig(subServerName) + walletKitServerConf, ok := configRegistry.FetchConfig(SubServerName) if !ok { return nil, nil, fmt.Errorf("unable to find config for "+ - "subserver type %s", subServerName) + "subserver type %s", SubServerName) } // Now that we've found an object mapping to our service name, we'll @@ -30,7 +30,7 @@ func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) ( config, ok := walletKitServerConf.(*Config) if !ok { return nil, nil, fmt.Errorf("wrong type of config for "+ - "subserver %s, expected %T got %T", subServerName, + "subserver %s, expected %T got %T", SubServerName, &Config{}, walletKitServerConf) } @@ -68,7 +68,7 @@ func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) ( func init() { subServer := &lnrpc.SubServerDriver{ - SubServerName: subServerName, + SubServerName: SubServerName, NewGrpcHandler: func() lnrpc.GrpcHandler { return &ServerShell{} }, @@ -78,6 +78,6 @@ func init() { // sub-RPC server within the global lnrpc package namespace. if err := lnrpc.RegisterSubServer(subServer); err != nil { panic(fmt.Sprintf("failed to register sub server driver '%s': %v", - subServerName, err)) + SubServerName, err)) } } diff --git a/lnrpc/walletrpc/walletkit_server.go b/lnrpc/walletrpc/walletkit_server.go index 93b698351..487f2ab4e 100644 --- a/lnrpc/walletrpc/walletkit_server.go +++ b/lnrpc/walletrpc/walletkit_server.go @@ -37,13 +37,6 @@ import ( "gopkg.in/macaroon-bakery.v2/bakery" ) -const ( - // subServerName is the name of the sub rpc server. We'll use this name - // to register ourselves, and we also require that the main - // SubServerConfigDispatcher instance recognize as the name of our - subServerName = "WalletKitRPC" -) - var ( // macaroonOps are the set of capabilities that our minted macaroon (if // it doesn't already exist) will have. @@ -256,7 +249,7 @@ func (w *WalletKit) Stop() error { // // NOTE: This is part of the lnrpc.SubServer interface. func (w *WalletKit) Name() string { - return subServerName + return SubServerName } // RegisterWithRootServer will be called by the root gRPC server to direct a