forked from TrueCloudLab/frostfs-node
[#1680] morph/netmap: Adopt to recent contract changes
After recent Netmap contract changes all read methods which return network map (either candidates or snapshots) encode node descriptors into same structure. Decode `netmap.Node` contract-side structure from the call results. Replace node state with the value from the `netmap.Node.State` field. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
d6c01199c8
commit
eb1fba5182
14 changed files with 135 additions and 221 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/nspcc-dev/neofs-contract/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -43,15 +44,16 @@ func TestParseUpdatePeer(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("correct behavior", func(t *testing.T) {
|
||||
const state = netmap.NodeStateMaintenance
|
||||
ev, err := ParseUpdatePeer(createNotifyEventFromItems([]stackitem.Item{
|
||||
stackitem.NewBigInteger(new(big.Int).SetInt64(1)),
|
||||
stackitem.NewBigInteger(big.NewInt(int64(state))),
|
||||
stackitem.NewByteArray(publicKey.Bytes()),
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, UpdatePeer{
|
||||
publicKey: publicKey,
|
||||
state: stateOnline,
|
||||
state: state,
|
||||
}, ev)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue