routerrpc: remove reflection-based initialization

This commit is contained in:
Joost Jager 2020-03-30 11:09:17 +02:00
parent ffa7bed7f0
commit 767c4f2298
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -219,21 +219,9 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
reflect.ValueOf(genInvoiceFeatures),
)
// RouterRPC isn't conditionally compiled and doesn't need to be
// populated using reflection.
case *routerrpc.Config:
subCfgValue := extractReflectValue(subCfg)
subCfgValue.FieldByName("NetworkDir").Set(
reflect.ValueOf(networkDir),
)
subCfgValue.FieldByName("MacService").Set(
reflect.ValueOf(macService),
)
subCfgValue.FieldByName("Router").Set(
reflect.ValueOf(chanRouter),
)
subCfgValue.FieldByName("RouterBackend").Set(
reflect.ValueOf(routerBackend),
)
case *watchtowerrpc.Config:
subCfgValue := extractReflectValue(subCfg)
@ -266,6 +254,12 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
}
}
// Populate routerrpc dependencies.
s.RouterRPC.NetworkDir = networkDir
s.RouterRPC.MacService = macService
s.RouterRPC.Router = chanRouter
s.RouterRPC.RouterBackend = routerBackend
return nil
}