[#787] morph: Return VUB for IR service calls
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
518f3baf41
commit
2393d13e4d
12 changed files with 78 additions and 41 deletions
|
@ -43,17 +43,20 @@ func (c *Client) AddPeer(p AddPeerPrm) error {
|
|||
}
|
||||
|
||||
// ForceRemovePeer marks the given peer as offline via a notary control transaction.
|
||||
func (c *Client) ForceRemovePeer(nodeInfo netmap.NodeInfo) error {
|
||||
// If vub > 0, vub will be used as valid until block value.
|
||||
func (c *Client) ForceRemovePeer(nodeInfo netmap.NodeInfo, vub uint32) (uint32, error) {
|
||||
if !c.client.WithNotary() {
|
||||
return fmt.Errorf("peer can be forcefully removed only in notary environment")
|
||||
return 0, fmt.Errorf("peer can be forcefully removed only in notary environment")
|
||||
}
|
||||
|
||||
prm := UpdatePeerPrm{}
|
||||
prm.SetKey(nodeInfo.PublicKey())
|
||||
prm.SetControlTX(true)
|
||||
prm.SetVUB(vub)
|
||||
|
||||
if err := c.UpdatePeerState(prm); err != nil {
|
||||
return fmt.Errorf("updating peer state: %v", err)
|
||||
vub, err := c.UpdatePeerState(prm)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("updating peer state: %v", err)
|
||||
}
|
||||
return nil
|
||||
return vub, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue