diff --git a/pkg/innerring/processors/netmap/wrappers.go b/pkg/innerring/processors/netmap/wrappers.go index 618c1fb8..e75fdaf4 100644 --- a/pkg/innerring/processors/netmap/wrappers.go +++ b/pkg/innerring/processors/netmap/wrappers.go @@ -45,8 +45,7 @@ func (w *netmapClientWrapper) NetMap() (*netmap.NetMap, error) { } func (w *netmapClientWrapper) NewEpoch(epoch uint64) error { - _, err := w.netmapClient.NewEpoch(epoch, 0, false) - return err + return w.netmapClient.NewEpoch(epoch) } func (w *netmapClientWrapper) MorphIsValidScript(script []byte, signers []transaction.Signer) (valid bool, err error) { diff --git a/pkg/morph/client/netmap/new_epoch.go b/pkg/morph/client/netmap/new_epoch.go index a596b999..ded386c8 100644 --- a/pkg/morph/client/netmap/new_epoch.go +++ b/pkg/morph/client/netmap/new_epoch.go @@ -8,15 +8,27 @@ import ( // NewEpoch updates FrostFS epoch number through // Netmap contract call. -// If `force` is true, this call is normally initiated by a control -// service command and uses a control notary transaction internally -// to ensure all nodes produce the same transaction with high probability. -// If vub > 0, vub will be used as valid until block value. -func (c *Client) NewEpoch(epoch uint64, vub uint32, force bool) (uint32, error) { +func (c *Client) NewEpoch(epoch uint64) error { prm := client.InvokePrm{} prm.SetMethod(newEpochMethod) prm.SetArgs(epoch) - prm.SetControlTX(force) + + _, err := c.client.Invoke(prm) + if err != nil { + return fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err) + } + return nil +} + +// NewEpochControl updates FrostFS epoch number through +// control notary transaction internally to ensure all +// nodes produce the same transaction with high probability. +// If vub > 0, vub will be used as valid until block value. +func (c *Client) NewEpochControl(epoch uint64, vub uint32) (uint32, error) { + prm := client.InvokePrm{} + prm.SetMethod(newEpochMethod) + prm.SetArgs(epoch) + prm.SetControlTX(true) prm.SetVUB(vub) res, err := c.client.Invoke(prm) diff --git a/pkg/services/control/ir/server/calls.go b/pkg/services/control/ir/server/calls.go index 4224ea81..7baae032 100644 --- a/pkg/services/control/ir/server/calls.go +++ b/pkg/services/control/ir/server/calls.go @@ -53,7 +53,7 @@ func (s *Server) TickEpoch(_ context.Context, req *control.TickEpochRequest) (*c return nil, fmt.Errorf("getting current epoch: %w", err) } - vub, err := s.netmapClient.NewEpoch(epoch+1, req.GetBody().GetVub(), true) + vub, err := s.netmapClient.NewEpochControl(epoch+1, req.GetBody().GetVub()) if err != nil { return nil, fmt.Errorf("forcing new epoch: %w", err) }