From 8562d53da01da765cfbbcc61e2870165f270dc12 Mon Sep 17 00:00:00 2001 From: parmarrushabh Date: Mon, 12 Nov 2018 16:54:06 +0530 Subject: [PATCH] Fixed delay longer than 10 seconds when near at block checkpoint. --- miner/worker.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/miner/worker.go b/miner/worker.go index cde1bd39c1..387a0bf66c 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -54,6 +54,8 @@ const ( chainSideChanSize = 10 // timeout waiting for M1 waitPeriod = 10 + // timeout for checkpoint. + waitPeriodCheckpoint = 60 ) // Agent can register themself with the worker @@ -496,6 +498,11 @@ func (self *worker) commitNewWork() { } h := hop(len(masternodes), preIndex, curIndex) gap := waitPeriod * int64(h) + // Check nearest checkpoint block in hop range. + nearest := self.config.XDPoA.Epoch - (parent.Header().Number.Uint64() % self.config.XDPoS.Epoch) + if uint64(h) >= nearest { + gap += waitPeriodCheckpoint + } log.Info("Distance from the parent block", "seconds", gap, "hops", h) L: select {