diff --git a/subrpcserver_config.go b/subrpcserver_config.go index 0abb969b..b63cf95c 100644 --- a/subrpcserver_config.go +++ b/subrpcserver_config.go @@ -5,6 +5,7 @@ import ( "reflect" "github.com/lightningnetwork/lnd/lnrpc/signrpc" + "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/macaroons" ) @@ -18,6 +19,12 @@ 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"` + + // WalletKitRPC is a sub-RPC server that exposes functionality allowing + // a client to send transactions through a wallet, publish them, and + // also requests keys and addresses under control of the backing + // wallet. + WalletKitRPC *walletrpc.Config `group:"walletrpc" namespace:"walletrpc"` } // PopulateDependencies attempts to iterate through all the sub-server configs @@ -66,6 +73,25 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl, reflect.ValueOf(cc.signer), ) + case *walletrpc.Config: + subCfgValue := extractReflectValue(cfg) + + subCfgValue.FieldByName("NetworkDir").Set( + reflect.ValueOf(networkDir), + ) + subCfgValue.FieldByName("MacService").Set( + reflect.ValueOf(macService), + ) + subCfgValue.FieldByName("FeeEstimator").Set( + reflect.ValueOf(cc.feeEstimator), + ) + subCfgValue.FieldByName("Wallet").Set( + reflect.ValueOf(cc.wallet), + ) + subCfgValue.FieldByName("KeyRing").Set( + reflect.ValueOf(cc.keyRing), + ) + default: return fmt.Errorf("unknown field: %v, %T", fieldName, cfg) @@ -88,7 +114,6 @@ func (s *subRPCServerConfigs) FetchConfig(subServerName string) (interface{}, bo // Now that we have the value of the struct, we can check to see if it // has an attribute with the same name as the subServerName. configVal := selfVal.FieldByName(subServerName) - configValElem := configVal.Elem() // We'll now ensure that this field actually exists in this value. If // not, then we'll return false for the ok value to indicate to the @@ -97,6 +122,8 @@ func (s *subRPCServerConfigs) FetchConfig(subServerName string) (interface{}, bo return nil, false } + configValElem := configVal.Elem() + // If a config of this type is found, it doesn't have any fields, then // it's the same as if it wasn't present. This can happen if the build // tag for the sub-server is inactive.