Await control.SetNetmapStatus() #1496

Merged
fyrchik merged 1 commit from fyrchik/frostfs-node:morph-wait-tx into master 2024-11-20 15:43:54 +00:00
3 changed files with 9 additions and 11 deletions

View file

@ -421,9 +421,12 @@ func (c *cfg) updateNetMapState(ctx context.Context, stateSetter func(*nmClient.
prm.SetKey(c.key.PublicKey().Bytes())
stateSetter(&prm)
_, err := c.cfgNetmap.wrapper.UpdatePeerState(ctx, prm)
res, err := c.cfgNetmap.wrapper.UpdatePeerState(ctx, prm)
if err != nil {
return err
}
return c.cfgNetmap.wrapper.Morph().WaitTxHalt(ctx, res)
}
type netInfo struct {
netState netmap.State

View file

@ -58,9 +58,9 @@ func (c *Client) ForceRemovePeer(ctx context.Context, nodeInfo netmap.NodeInfo,
prm.SetControlTX(true)
prm.SetVUB(vub)
vub, err := c.UpdatePeerState(ctx, prm)
res, err := c.UpdatePeerState(ctx, prm)
if err != nil {
return 0, fmt.Errorf("updating peer state: %v", err)
}
return vub, nil
return res.VUB, nil
}

View file

@ -2,7 +2,6 @@ package netmap
import (
"context"
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-contract/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
@ -37,7 +36,7 @@ func (u *UpdatePeerPrm) SetMaintenance() {
}
// UpdatePeerState changes peer status through Netmap contract call.
func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (uint32, error) {
func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (client.InvokeRes, error) {
method := updateStateMethod
if c.client.WithNotary() && c.client.IsAlpha() {
@ -56,9 +55,5 @@ func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (uint32,
prm.SetArgs(int64(p.state), p.key)
prm.InvokePrmOptional = p.InvokePrmOptional
res, err := c.client.Invoke(ctx, prm)
if err != nil {
return 0, fmt.Errorf("could not invoke smart contract: %w", err)
}
return res.VUB, nil
return c.client.Invoke(ctx, prm)
}