[#1208] innerring: Disallow to tick timer twice on the same height

Provide current heights as an argument to ticker.
Zero height disables any checks, thus corresponding to the old
behaviour. If non-zero height is used, ignore the tick if the height
is less than the timer tick state.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-03-30 13:16:41 +03:00 committed by Alex Vanin
parent c0e65dadaf
commit 4770cb8bf6
4 changed files with 68 additions and 8 deletions

View file

@ -66,9 +66,9 @@ func (s *Server) startBlockTimers() error {
return nil
}
func (s *Server) tickTimers() {
func (s *Server) tickTimers(h uint32) {
for i := range s.blockTimers {
s.blockTimers[i].Tick()
s.blockTimers[i].Tick(h)
}
}