diff --git a/lnrpc/signrpc/config_active.go b/lnrpc/signrpc/config_active.go index ab576d9d..a72d8fbd 100644 --- a/lnrpc/signrpc/config_active.go +++ b/lnrpc/signrpc/config_active.go @@ -1,4 +1,4 @@ -// +build signerrpc +// +build signrpc package signrpc diff --git a/lnrpc/signrpc/config_default.go b/lnrpc/signrpc/config_default.go index 3341296f..7698f19f 100644 --- a/lnrpc/signrpc/config_default.go +++ b/lnrpc/signrpc/config_default.go @@ -1,10 +1,6 @@ -// +build !signerrpc +// +build !signrpc package signrpc -// Config is the primary configuration struct for the signer 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 -// configuration options, while if able to be populated, the latter fields MUST -// also be specified. +// Config is empty for non-signrpc builds. type Config struct{} diff --git a/lnrpc/signrpc/driver.go b/lnrpc/signrpc/driver.go index 7065d8e4..b598c33c 100644 --- a/lnrpc/signrpc/driver.go +++ b/lnrpc/signrpc/driver.go @@ -34,10 +34,13 @@ func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) ( &Config{}, signServerConf) } + // Before we try to make the new signer service instance, we'll perform + // some sanity checks on the arguments to ensure that they're useable. + + switch { // If the macaroon service is set (we should use macaroons), then // ensure that we know where to look for them, or create them if not // found. - switch { case config.MacService != nil && config.NetworkDir == "": return nil, nil, fmt.Errorf("NetworkDir must be set to create " + "Signrpc") @@ -52,7 +55,9 @@ func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) ( func init() { subServer := &lnrpc.SubServerDriver{ SubServerName: subServerName, - New: func(c lnrpc.SubServerConfigDispatcher) (lnrpc.SubServer, lnrpc.MacaroonPerms, error) { + New: func(c lnrpc.SubServerConfigDispatcher) ( + lnrpc.SubServer, lnrpc.MacaroonPerms, error) { + return createNewSubServer(c) }, } diff --git a/lnrpc/sub_server.go b/lnrpc/sub_server.go index 1a3f58bb..1e58a2a6 100644 --- a/lnrpc/sub_server.go +++ b/lnrpc/sub_server.go @@ -1,24 +1,24 @@ package lnrpc import ( - fmt "fmt" + "fmt" "sync" "google.golang.org/grpc" "gopkg.in/macaroon-bakery.v2/bakery" ) -// MacaroonPerms is a map from the FullMethod of an invoked gRPC command. to -// the set of operations that the macaroon presented with the command MUST +// MacaroonPerms is a map from the FullMethod of an invoked gRPC command. It +// maps the set of operations that the macaroon presented with the command MUST // satisfy. With this map, all sub-servers are able to communicate to the // primary macaroon service what type of macaroon must be passed with each // method present on the service of the sub-server. type MacaroonPerms map[string][]bakery.Op // SubServer is a child server of the main lnrpc gRPC server. Sub-servers allow -// lnd to expose discrete services that can be use with or independent of the +// lnd to expose discrete services that can be used with or independent of the // main RPC server. The main rpcserver will create, start, stop, and manage -// each ubs-server in a generalized manner. +// each sub-server in a generalized manner. type SubServer interface { // Start starts the sub-server and all goroutines it needs to operate. Start() error