frostfs-node/pkg/morph/event/netmap/add_peer.go
Pavel Karpy c87bc70536 [] pkg/morph/event: Fix typo in AddPeer parser
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00

38 lines
701 B
Go

package netmap
import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
)
type AddPeer struct {
node []byte
}
// MorphEvent implements Neo:Morph Event interface.
func (AddPeer) MorphEvent() {}
func (s AddPeer) Node() []byte {
return s.node
}
func ParseAddPeer(prms []stackitem.Item) (event.Event, error) {
var (
ev AddPeer
err error
)
if ln := len(prms); ln != 1 {
return nil, event.WrongNumberOfParameters(1, ln)
}
ev.node, err = client.BytesFromStackItem(prms[0])
if err != nil {
return nil, fmt.Errorf("could not get raw nodeinfo: %w", err)
}
return ev, nil
}