[#1382] ir: Replace deprecated methods

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-09-18 12:24:53 +03:00
parent d4be2f20d4
commit a603d14d08
6 changed files with 10 additions and 10 deletions

View file

@ -60,7 +60,7 @@ func (c *cleanupTable) update(snapshot netmap.NetMap, now uint64) {
}
access.binNodeInfo = binNodeInfo
access.maintenance = nmNodes[i].IsMaintenance()
access.maintenance = nmNodes[i].Status().IsMaintenance()
newMap[keyString] = access
}

View file

@ -127,7 +127,7 @@ func TestCleanupTable(t *testing.T) {
t.Run("skip maintenance nodes", func(t *testing.T) {
cnt := 0
infos[1].SetMaintenance()
infos[1].SetStatus(netmap.Maintenance)
key := netmap.StringifyPublicKey(infos[1])
c.update(networkMap, 5)

View file

@ -146,7 +146,7 @@ func TestAddPeer(t *testing.T) {
require.Nil(t, nc.notaryInvokes, "invalid notary invokes")
node.SetOnline()
node.SetStatus(netmap.Online)
ev = netmapEvent.AddPeer{
NodeBytes: node.Marshal(),
Request: &payload.P2PNotaryRequest{

View file

@ -56,11 +56,11 @@ func (x *NetMapCandidateValidator) SetNetworkSettings(netSettings NetworkSetting
//
// See also netmap.NodeInfo.IsOnline/SetOnline and other similar methods.
func (x *NetMapCandidateValidator) VerifyAndUpdate(node *netmap.NodeInfo) error {
if node.IsOnline() {
if node.Status().IsOnline() {
return nil
}
if node.IsMaintenance() {
if node.Status().IsMaintenance() {
return x.netSettings.MaintenanceModeAllowed()
}

View file

@ -41,22 +41,22 @@ func TestValidator_VerifyAndUpdate(t *testing.T) {
},
{
name: "ONLINE",
preparer: (*netmap.NodeInfo).SetOnline,
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Online) },
valid: true,
},
{
name: "OFFLINE",
preparer: (*netmap.NodeInfo).SetOffline,
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Offline) },
valid: false,
},
{
name: "MAINTENANCE/allowed",
preparer: (*netmap.NodeInfo).SetMaintenance,
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Maintenance) },
valid: true,
},
{
name: "MAINTENANCE/disallowed",
preparer: (*netmap.NodeInfo).SetMaintenance,
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Maintenance) },
valid: false,
validatorPreparer: func(v *state.NetMapCandidateValidator) {
var s testNetworkSettings

View file

@ -62,7 +62,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) bool {
// But there is no guarantee that code will be executed in the same order.
// That is why we need to perform `addPeerIR` only in case when node is online,
// because in scope of this method, contract set state `ONLINE` for the node.
if updated && nodeInfo.IsOnline() {
if updated && nodeInfo.Status().IsOnline() {
np.log.Info(logs.NetmapApprovingNetworkMapCandidate,
zap.String("key", keyString))