mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
Fixed delay longer than 10 seconds when near at block checkpoint.
This commit is contained in:
parent
6f4bb10efd
commit
8562d53da0
1 changed files with 7 additions and 0 deletions
|
|
@ -54,6 +54,8 @@ const (
|
||||||
chainSideChanSize = 10
|
chainSideChanSize = 10
|
||||||
// timeout waiting for M1
|
// timeout waiting for M1
|
||||||
waitPeriod = 10
|
waitPeriod = 10
|
||||||
|
// timeout for checkpoint.
|
||||||
|
waitPeriodCheckpoint = 60
|
||||||
)
|
)
|
||||||
|
|
||||||
// Agent can register themself with the worker
|
// Agent can register themself with the worker
|
||||||
|
|
@ -496,6 +498,11 @@ func (self *worker) commitNewWork() {
|
||||||
}
|
}
|
||||||
h := hop(len(masternodes), preIndex, curIndex)
|
h := hop(len(masternodes), preIndex, curIndex)
|
||||||
gap := waitPeriod * int64(h)
|
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)
|
log.Info("Distance from the parent block", "seconds", gap, "hops", h)
|
||||||
L:
|
L:
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue