[#708] morph/client: Add epoch block getter from netmap

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-07-21 15:55:05 +03:00 committed by Alex Vanin
parent 7e43af3de3
commit 7146afcd28
3 changed files with 57 additions and 0 deletions

View file

@ -18,3 +18,16 @@ func (w *Wrapper) Epoch() (uint64, error) {
return uint64(vals.Number()), nil
}
// LastEpochBlock receives block number of current NeoFS epoch
// through the Netmap contract call.
func (w *Wrapper) LastEpochBlock() (uint32, error) {
args := netmap.EpochBlockArgs{}
vals, err := w.client.LastEpochBlock(args)
if err != nil {
return 0, fmt.Errorf("(%T) could not get epoch block number: %w", w, err)
}
return uint32(vals.Block()), nil
}