Add Inner Ring code
This commit is contained in:
parent
dadfd90dcd
commit
b7b5079934
400 changed files with 11420 additions and 8690 deletions
32
pkg/morph/client/netmap/wrapper/update_state.go
Normal file
32
pkg/morph/client/netmap/wrapper/update_state.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package wrapper
|
||||
|
||||
import (
|
||||
contract "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// NodeState is a type of node states enumeration.
|
||||
type NodeState int64
|
||||
|
||||
const (
|
||||
_ NodeState = iota
|
||||
|
||||
// StateOffline is an offline node state value.
|
||||
StateOffline
|
||||
)
|
||||
|
||||
// UpdatePeerState changes peer status through Netmap contract
|
||||
// call.
|
||||
func (w *Wrapper) UpdatePeerState(key []byte, state NodeState) error {
|
||||
args := contract.UpdateStateArgs{}
|
||||
args.SetPublicKey(key)
|
||||
args.SetState(int64(state))
|
||||
|
||||
// invoke smart contract call
|
||||
//
|
||||
// Note: errors.Wrap returns nil on nil error arg.
|
||||
return errors.Wrap(
|
||||
w.client.UpdateState(args),
|
||||
"could not invoke smart contract",
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue