diff --git a/rpcserver.go b/rpcserver.go index 15711a147..e23288057 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -416,7 +416,7 @@ func newRPCServer(s *server, macService *macaroons.Service, // server configuration struct. err := subServerCgs.PopulateDependencies( s.cc, networkDir, macService, atpl, invoiceRegistry, - activeNetParams.Params, + activeNetParams.Params, s.chanRouter, ) if err != nil { return nil, err diff --git a/subrpcserver_config.go b/subrpcserver_config.go index cf7e8877c..fbc446155 100644 --- a/subrpcserver_config.go +++ b/subrpcserver_config.go @@ -10,9 +10,11 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc" "github.com/lightningnetwork/lnd/lnrpc/chainrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" + "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/macaroons" + "github.com/lightningnetwork/lnd/routing" ) // subRPCServerConfigs is special sub-config in the main configuration that @@ -44,6 +46,12 @@ type subRPCServerConfigs struct { // InvoicesRPC is a sub-RPC server that exposes invoice related methods // as a gRPC service. InvoicesRPC *invoicesrpc.Config `group:"invoicesrpc" namespace:"invoicesrpc"` + + // RouterRPC is a sub-RPC server the exposes functionality that allows + // clients to send payments on the network, and perform Lightning + // payment related queries such as requests for estimates of off-chain + // fees. + RouterRPC *routerrpc.Config `group:"routerrpc" namespace:"routerrpc"` } // PopulateDependencies attempts to iterate through all the sub-server configs @@ -56,7 +64,8 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl, networkDir string, macService *macaroons.Service, atpl *autopilot.Manager, invoiceRegistry *invoices.InvoiceRegistry, - activeNetParams *chaincfg.Params) error { + activeNetParams *chaincfg.Params, + chanRouter *routing.ChannelRouter) error { // First, we'll use reflect to obtain a version of the config struct // that allows us to programmatically inspect its fields. @@ -150,6 +159,22 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl, reflect.ValueOf(activeNetParams), ) + case *routerrpc.Config: + subCfgValue := extractReflectValue(cfg) + + subCfgValue.FieldByName("NetworkDir").Set( + reflect.ValueOf(networkDir), + ) + subCfgValue.FieldByName("ActiveNetParams").Set( + reflect.ValueOf(activeNetParams), + ) + subCfgValue.FieldByName("MacService").Set( + reflect.ValueOf(macService), + ) + subCfgValue.FieldByName("Router").Set( + reflect.ValueOf(chanRouter), + ) + default: return fmt.Errorf("unknown field: %v, %T", fieldName, cfg)