diff --git a/node/node.go b/node/node.go index 2e3c5d8..a608bb1 100644 --- a/node/node.go +++ b/node/node.go @@ -52,7 +52,7 @@ func NewNode(config *config.NodeConfig) interfaces.Node { hashQueryRoutingTable: structs.NewMap(), httpClient: resty.New(), } - n.services = NewServices(service.NewP2P(n)) + n.services = NewServices(service.NewP2P(n), service.NewRegistry(n)) return n } diff --git a/node/services.go b/node/services.go index 8d84e4c..64b09ba 100644 --- a/node/services.go +++ b/node/services.go @@ -23,8 +23,11 @@ func (s *ServicesImpl) Registry() interfaces.RegistryService { return s.registry } -func NewServices(p2p interfaces.P2PService) *ServicesImpl { - return &ServicesImpl{p2p: p2p} +func NewServices(p2p interfaces.P2PService, registry interfaces.RegistryService) interfaces.Services { + return &ServicesImpl{ + p2p: p2p, + registry: registry, + } } func (s *ServicesImpl) P2P() interfaces.P2PService { diff --git a/service/registry.go b/service/registry.go index 707123e..f98a161 100644 --- a/service/registry.go +++ b/service/registry.go @@ -44,10 +44,10 @@ func (r *RegistryImpl) Init() error { return utils.CreateBucket(registryBucketName, r.node.Db()) } -func NewRegistry(node interfaces.Node, logger *zap.Logger) *RegistryImpl { +func NewRegistry(node interfaces.Node) *RegistryImpl { return &RegistryImpl{ node: node, - logger: logger, + logger: node.Logger(), streams: structs.NewMap(), subs: structs.NewMap(), }