[#1208] innerring: Fix race condition between handling new epoch and block

Before resetting the timer, ensure the block tick is processed.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-04-04 10:07:33 +03:00 committed by Alex Vanin
parent 4770cb8bf6
commit e8bf18c0b4
5 changed files with 59 additions and 3 deletions

View file

@ -23,7 +23,15 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
}
np.epochState.SetEpochCounter(epoch)
if err := np.epochTimer.ResetEpochTimer(); err != nil {
h, err := np.netmapClient.Morph().TxHeight(ev.TxHash())
if err != nil {
np.log.Warn("can't get transaction height",
zap.String("hash", ev.TxHash().StringLE()),
zap.String("error", err.Error()))
}
if err := np.epochTimer.ResetEpochTimer(h); err != nil {
np.log.Warn("can't reset epoch timer",
zap.String("error", err.Error()))
}