[#114] Add remove-node IR control command

Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
Alejandro Lopez 2023-05-03 16:19:46 +03:00 committed by Evgenii Stratonikov
parent ea10abb42a
commit 90799497d3
10 changed files with 676 additions and 54 deletions

View file

@ -41,3 +41,19 @@ func (c *Client) AddPeer(p AddPeerPrm) error {
}
return nil
}
// ForceRemovePeer marks the given peer as offline via a notary control transaction.
func (c *Client) ForceRemovePeer(nodeInfo netmap.NodeInfo) error {
if !c.client.WithNotary() {
return fmt.Errorf("peer can be forcefully removed only in notary environment")
}
prm := UpdatePeerPrm{}
prm.SetKey(nodeInfo.PublicKey())
prm.SetControlTX(true)
if err := c.UpdatePeerState(prm); err != nil {
return fmt.Errorf("updating peer state: %v", err)
}
return nil
}