frostfs-node/pkg/morph/client/netmap/wrapper/update_state.go

23 lines
560 B
Go
Raw Normal View History

2020-07-24 13:54:03 +00:00
package wrapper
import (
"fmt"
2020-07-24 13:54:03 +00:00
contract "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
"github.com/nspcc-dev/neofs-sdk-go/netmap"
2020-07-24 13:54:03 +00:00
)
// UpdatePeerState changes peer status through Netmap contract
// call.
func (w *Wrapper) UpdatePeerState(key []byte, state netmap.NodeState) error {
2020-07-24 13:54:03 +00:00
args := contract.UpdateStateArgs{}
args.SetPublicKey(key)
args.SetState(int64(state.ToV2()))
2020-07-24 13:54:03 +00:00
// invoke smart contract call
if err := w.client.UpdateState(args); err != nil {
return fmt.Errorf("could not invoke smart contract: %w", err)
}
return nil
2020-07-24 13:54:03 +00:00
}