mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
fix: use a named deadline timer in CCC stage (#782)
This commit is contained in:
parent
ab349d6443
commit
094a67a179
2 changed files with 4 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 5 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 28 // Patch version component of the current release
|
||||
VersionPatch = 29 // Patch version component of the current release
|
||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -310,14 +310,16 @@ func (p *Pipeline) cccStage(candidates <-chan *BlockCandidate, deadline time.Tim
|
|||
var deadlineReached bool
|
||||
|
||||
go func() {
|
||||
deadlineTimer := time.NewTimer(time.Until(deadline))
|
||||
defer func() {
|
||||
close(resultCh)
|
||||
deadlineTimer.Stop()
|
||||
lifetimeTimer.UpdateSince(p.start)
|
||||
}()
|
||||
for {
|
||||
idleStart := time.Now()
|
||||
select {
|
||||
case <-time.After(time.Until(deadline)):
|
||||
case <-deadlineTimer.C:
|
||||
cccIdleTimer.UpdateSince(idleStart)
|
||||
// note: currently we don't allow empty blocks, but if we ever do; make sure to CCC check it first
|
||||
if lastCandidate != nil {
|
||||
|
|
@ -328,8 +330,6 @@ func (p *Pipeline) cccStage(candidates <-chan *BlockCandidate, deadline time.Tim
|
|||
return
|
||||
}
|
||||
deadlineReached = true
|
||||
// avoid deadline case being triggered again and again
|
||||
deadline = time.Now().Add(time.Hour)
|
||||
case candidate := <-candidates:
|
||||
cccIdleTimer.UpdateSince(idleStart)
|
||||
cccStart := time.Now()
|
||||
|
|
|
|||
Loading…
Reference in a new issue