From d05b2ff5007db68d97dad312841263a22011071f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 14:24:08 +0300 Subject: [PATCH] [#83] cmd/neofs-node: Add network state option to response service Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 7 ++++++- cmd/neofs-node/netmap.go | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index fbf963f13..dbc31af3c 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -228,6 +228,8 @@ func initCfg(path string) *cfg { maxChunkSize := viperCfg.GetUint64(cfgMaxMsgSize) * 3 / 4 // 25% to meta, 75% to payload maxAddrAmount := maxChunkSize / addressSize // each address is about 72 bytes + state := newNetworkState() + c := &cfg{ ctx: context.Background(), viper: viperCfg, @@ -246,6 +248,7 @@ func initCfg(path string) *cfg { cfgNetmap: cfgNetmap{ scriptHash: u160Netmap, fee: util.Fixed8(viperCfg.GetInt(cfgNetmapFee)), + state: state, }, cfgNodeInfo: cfgNodeInfo{ bootType: StorageNode, @@ -260,7 +263,9 @@ func initCfg(path string) *cfg { enableReflectService: viperCfg.GetBool(cfgReflectService), }, localAddr: netAddr, - respSvc: response.NewService(), + respSvc: response.NewService( + response.WithNetworkState(state), + ), } initLocalStorage(c) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index fdc3df1d7..ad149851f 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -55,7 +55,6 @@ func initNetmapService(c *cfg) { ), ) - c.cfgNetmap.state = newNetworkState() addNewEpochNotificationHandler(c, func(ev event.Event) { c.cfgNetmap.state.setCurrentEpoch(ev.(netmapEvent.NewEpoch).EpochNumber()) })