[#74] Fix order of netmap.UpdateState event arguments

This event has node status first and public key second.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-05 18:29:06 +03:00 committed by Alex Vanin
parent cd34145969
commit f40f1ca0c0

View file

@ -36,8 +36,16 @@ func ParseUpdatePeer(prms []smartcontract.Parameter) (event.Event, error) {
return nil, event.WrongNumberOfParameters(2, ln)
}
// parse node status
st, err := client.IntFromStackParameter(prms[0])
if err != nil {
return nil, errors.Wrap(err, "could not get node status")
}
ev.status = uint32(st)
// parse public key
key, err := client.BytesFromStackParameter(prms[0])
key, err := client.BytesFromStackParameter(prms[1])
if err != nil {
return nil, errors.Wrap(err, "could not get public key")
}
@ -47,13 +55,5 @@ func ParseUpdatePeer(prms []smartcontract.Parameter) (event.Event, error) {
return nil, errors.Wrap(err, "could not parse public key")
}
// parse node status
st, err := client.IntFromStackParameter(prms[1])
if err != nil {
return nil, errors.Wrap(err, "could not get node status")
}
ev.status = uint32(st)
return ev, nil
}