[#298] ir: Fix parser of UpdateState notification event of Netmap contract
The order of event stack items is {state, key}. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
07a6e2cc43
commit
d26716e792
2 changed files with 3 additions and 3 deletions
|
@ -39,7 +39,7 @@ func ParseUpdatePeer(prms []stackitem.Item) (event.Event, error) {
|
|||
}
|
||||
|
||||
// parse public key
|
||||
key, err := client.BytesFromStackItem(prms[0])
|
||||
key, err := client.BytesFromStackItem(prms[1])
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get public key")
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func ParseUpdatePeer(prms []stackitem.Item) (event.Event, error) {
|
|||
}
|
||||
|
||||
// parse node status
|
||||
st, err := client.IntFromStackItem(prms[1])
|
||||
st, err := client.IntFromStackItem(prms[0])
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get node status")
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ func TestParseUpdatePeer(t *testing.T) {
|
|||
|
||||
t.Run("correct behavior", func(t *testing.T) {
|
||||
ev, err := ParseUpdatePeer([]stackitem.Item{
|
||||
stackitem.NewByteArray(crypto.MarshalPublicKey(publicKey)),
|
||||
stackitem.NewBigInteger(new(big.Int).SetInt64(int64(state.ToV2()))),
|
||||
stackitem.NewByteArray(crypto.MarshalPublicKey(publicKey)),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
Loading…
Reference in a new issue