diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 8347cfbe0f..2258f85d5f 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -262,7 +262,8 @@ type cfgNetmap struct { state *networkState reBootstrapEnabled bool - reBootstrapInterval uint64 // in epochs + reBoostrapTurnedOff *atomic.Bool // managed by control service in runtime + reBootstrapInterval uint64 // in epochs goOfflineEnabled bool // send `UpdateState(offline)` tx at shutdown } @@ -377,6 +378,7 @@ func initCfg(path string) *cfg { workerPool: netmapWorkerPool, reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval), reBootstrapEnabled: viperCfg.GetBool(cfgReBootstrapEnabled), + reBoostrapTurnedOff: atomic.NewBool(false), goOfflineEnabled: viperCfg.GetBool(cfgShutdownOfflineEnabled), }, cfgNodeInfo: cfgNodeInfo{ diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 2333a648c2..26d17d4130 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -75,6 +75,10 @@ func initNetmapService(c *cfg) { if c.cfgNetmap.reBootstrapEnabled { addNewEpochAsyncNotificationHandler(c, func(ev event.Event) { + if c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470 + return + } + n := ev.(netmapEvent.NewEpoch).EpochNumber() if n%c.cfgNetmap.reBootstrapInterval == 0 { @@ -202,6 +206,7 @@ func goOffline(c *cfg) { func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error { if st == control.NetmapStatus_ONLINE { + c.cfgNetmap.reBoostrapTurnedOff.Store(false) return c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo()) } @@ -211,6 +216,8 @@ func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error { apiState = netmapSDK.NodeStateOffline } + c.cfgNetmap.reBoostrapTurnedOff.Store(true) + return c.cfgNetmap.wrapper.UpdatePeerState( crypto.MarshalPublicKey(&c.key.PublicKey), apiState,