[#1833] node: Update local node info on nil updates

If the contract returns a netmap that does not contain the node, update
local `NodeInfo`. It fixes `neofs-cli netmap nodeinfo` command that printed
"state: online" previously.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-10-10 23:04:00 +03:00 committed by fyrchik
parent c5fdb7bedf
commit 9e2edfedc6
2 changed files with 12 additions and 0 deletions

View file

@ -34,6 +34,7 @@ Changelog for NeoFS Node
- Correlation of object session to request (#1420) - Correlation of object session to request (#1420)
- Do not increase error counter in `engine.Inhume` if shard is read-only (#1839) - Do not increase error counter in `engine.Inhume` if shard is read-only (#1839)
- `control drop-objects` can remove split objects (#1830) - `control drop-objects` can remove split objects (#1830)
- Node's status in `neofs-cli netmap nodeinfo` command (#1833)
### Removed ### Removed
- Remove WIF and NEP2 support in `neofs-cli`'s --wallet flag (#1128) - Remove WIF and NEP2 support in `neofs-cli`'s --wallet flag (#1128)

View file

@ -65,6 +65,17 @@ func (s *networkState) setNodeInfo(ni *netmapSDK.NodeInfo) {
} }
} else { } else {
ctrlNetSt = control.NetmapStatus_OFFLINE ctrlNetSt = control.NetmapStatus_OFFLINE
niRaw := s.nodeInfo.Load()
if niRaw != nil {
niOld := niRaw.(netmapSDK.NodeInfo)
// nil ni means that the node is not included
// in the netmap
niOld.SetOffline()
s.nodeInfo.Store(niOld)
}
} }
s.controlNetStatus.Store(ctrlNetSt) s.controlNetStatus.Store(ctrlNetSt)