[#478] innerring: Use dynamic epoch duration in epoch timer

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-15 09:43:49 +03:00 committed by Alex Vanin
parent c33512d976
commit dc0bd782d2
3 changed files with 19 additions and 5 deletions

View file

@ -29,9 +29,9 @@ type (
cnrWrapper *container.Wrapper // to invoke stop container estimation
epoch epochState // to specify which epoch to stop
epochDuration uint32 // in blocks
stopEstimationDMul uint32 // X: X/Y of epoch in blocks
stopEstimationDDiv uint32 // Y: X/Y of epoch in blocks
epochDuration timers.BlockMeter // in blocks
stopEstimationDMul uint32 // X: X/Y of epoch in blocks
stopEstimationDDiv uint32 // Y: X/Y of epoch in blocks
collectBasicIncome subEpochEventHandler
distributeBasicIncome subEpochEventHandler
@ -74,7 +74,7 @@ func (s *Server) tickTimers() {
func newEpochTimer(args *epochTimerArgs) *timers.BlockTimer {
epochTimer := timers.NewBlockTimer(
timers.StaticBlockMeter(args.epochDuration),
args.epochDuration,
func() {
args.nm.HandleNewEpochTick(timers.NewEpochTick{})
},