forked from TrueCloudLab/frostfs-node
[#833] morph/client: Implement MsPerBlock method
Add `Client.MsPerBlock` method which reads MillisecondsPerBlock network parameter. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3929f6b396
commit
cb22e2bf29
1 changed files with 17 additions and 0 deletions
|
@ -457,3 +457,20 @@ func (c *Client) BlockCount() (res uint32, err error) {
|
||||||
|
|
||||||
return c.client.GetBlockCount()
|
return c.client.GetBlockCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MsPerBlock returns MillisecondsPerBlock network parameter.
|
||||||
|
func (c *Client) MsPerBlock() (res int64, err error) {
|
||||||
|
if c.multiClient != nil {
|
||||||
|
return res, c.multiClient.iterateClients(func(c *Client) error {
|
||||||
|
res, err = c.MsPerBlock()
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
v, err := c.client.GetVersion()
|
||||||
|
if err != nil {
|
||||||
|
return 0, fmt.Errorf("getVersion: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return int64(v.Protocol.MillisecondsPerBlock), nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue