[#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

@ -11,14 +11,17 @@ import (
// 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.
func (c *Client) NewEpoch(epoch uint64, force bool) error {
// If vub > 0, vub will be used as valid until block value.
func (c *Client) NewEpoch(epoch uint64, vub uint32, force bool) (uint32, error) {
prm := client.InvokePrm{}
prm.SetMethod(newEpochMethod)
prm.SetArgs(epoch)
prm.SetControlTX(force)
prm.SetVUB(vub)
if _, err := c.client.Invoke(prm); err != nil {
return fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
res, err := c.client.Invoke(prm)
if err != nil {
return 0, fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
}
return nil
return res.VUB, nil
}