frostfs-node/pkg/morph/client/netmap/update_state.go
Leonard Lyubich 159351fd55 [#298] morph/netmap: Fix invocation of UpdateState contract method
Fix incorrect method name. Fix the order of arguments (should be {state,
key}).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-01-11 18:42:09 +03:00

34 lines
738 B
Go

package netmap
import (
"github.com/pkg/errors"
)
// UpdateStateArgs groups the arguments
// of update state invocation call.
type UpdateStateArgs struct {
key []byte // peer public key
state int64 // new peer state
}
// SetPublicKey sets peer public key
// in a binary format.
func (u *UpdateStateArgs) SetPublicKey(v []byte) {
u.key = v
}
// SetState sets the new peer state.
func (u *UpdateStateArgs) SetState(v int64) {
u.state = v
}
// UpdateState invokes the call of update state method
// of NeoFS Netmap contract.
func (c *Client) UpdateState(args UpdateStateArgs) error {
return errors.Wrapf(c.client.Invoke(
c.updateStateMethod,
args.state,
args.key,
), "could not invoke method (%s)", c.updateStateMethod)
}