[#787] morph: Return VUB for IR service calls

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-11-08 12:05:03 +03:00
parent 518f3baf41
commit 2393d13e4d
12 changed files with 78 additions and 41 deletions

View file

@ -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
}