mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
fix: make consensus engine wait for a bit before giving up on worker (#774)
and if it happens despite the wait, let worker retry
This commit is contained in:
parent
dd7f747754
commit
b9919a572a
3 changed files with 9 additions and 3 deletions
|
|
@ -648,6 +648,8 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
|
||||||
// Wait until sealing is terminated or delay timeout.
|
// Wait until sealing is terminated or delay timeout.
|
||||||
log.Trace("Waiting for slot to sign and propagate", "delay", common.PrettyDuration(delay))
|
log.Trace("Waiting for slot to sign and propagate", "delay", common.PrettyDuration(delay))
|
||||||
go func() {
|
go func() {
|
||||||
|
defer close(results)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-stop:
|
case <-stop:
|
||||||
return
|
return
|
||||||
|
|
@ -656,7 +658,7 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case results <- block.WithSeal(header):
|
case results <- block.WithSeal(header):
|
||||||
default:
|
case <-time.After(time.Second):
|
||||||
log.Warn("Sealing result is not read by miner", "sealhash", SealHash(header))
|
log.Warn("Sealing result is not read by miner", "sealhash", SealHash(header))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -651,8 +651,12 @@ func (w *worker) commit(res *pipeline.Result) error {
|
||||||
if err := w.engine.Seal(w.chain, block, resultCh, stopCh); err != nil {
|
if err := w.engine.Seal(w.chain, block, resultCh, stopCh); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// Clique.Seal() will only wait for a second before giving up on us. So make sure there is nothing computational heavy
|
||||||
|
// or a call that blocks between the call to Seal and the line below
|
||||||
block = <-resultCh
|
block = <-resultCh
|
||||||
|
if block == nil {
|
||||||
|
return errors.New("missed seal response from consensus engine")
|
||||||
|
}
|
||||||
|
|
||||||
// verify the generated block with local consensus engine to make sure everything is as expected
|
// verify the generated block with local consensus engine to make sure everything is as expected
|
||||||
if err = w.engine.VerifyHeader(w.chain, block.Header(), true); err != nil {
|
if err = w.engine.VerifyHeader(w.chain, block.Header(), true); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 3 // Minor version component of the current release
|
VersionMinor = 3 // Minor version component of the current release
|
||||||
VersionPatch = 23 // Patch version component of the current release
|
VersionPatch = 24 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue