diff options
author | aaronbuchwald <[email protected]> | 2020-12-11 17:36:35 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-11 17:36:35 -0500 |
commit | 1a6f9ad7584bdcc074f09525fac4fc9ceb2916ec (patch) | |
tree | b7c5b37e51c4d99e92cbad7dd6056ca9714ec028 /miner/worker.go | |
parent | 1a2684b86bb613c9c08b8d55915fc1d082e70f88 (diff) | |
parent | 0dd94e2a926b929c371d06c463f917a2c70d427d (diff) |
Merge pull request #67 from ava-labs/timestampv0.3.17-rc.1
Improve miner handling of asynchronous block production
Diffstat (limited to 'miner/worker.go')
-rw-r--r-- | miner/worker.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/miner/worker.go b/miner/worker.go index 72597b0..2b44691 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -913,12 +913,15 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64) //timestamp = int64(parent.Time() + 1) timestamp = int64(parent.Time()) } - // this will ensure we're not going off too far in the future - if now := time.Now().Unix(); timestamp > now+1 { - wait := time.Duration(timestamp-now) * time.Second - log.Info("Mining too far in the future", "wait", common.PrettyDuration(wait)) - time.Sleep(wait) - } + // This block has been removed to prevent BuildBlock + // from blocking until this chain advances to timestamp + // This prevents a block issued up to 30s in the future + // from causing an unnecessary sleep + // if now := time.Now().Unix(); timestamp > now+1 { + // wait := time.Duration(timestamp-now) * time.Second + // log.Info("Mining too far in the future", "wait", common.PrettyDuration(wait)) + // time.Sleep(wait) + // } num := parent.Number() header := &types.Header{ |