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:
Ömer Faruk Irmak 2024-05-27 19:44:40 +03:00 committed by GitHub
parent dd7f747754
commit b9919a572a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View file

@ -648,6 +648,8 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
// Wait until sealing is terminated or delay timeout.
log.Trace("Waiting for slot to sign and propagate", "delay", common.PrettyDuration(delay))
go func() {
defer close(results)
select {
case <-stop:
return
@ -656,7 +658,7 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
select {
case results <- block.WithSeal(header):
default:
case <-time.After(time.Second):
log.Warn("Sealing result is not read by miner", "sealhash", SealHash(header))
}
}()

View file

@ -651,8 +651,12 @@ func (w *worker) commit(res *pipeline.Result) error {
if err := w.engine.Seal(w.chain, block, resultCh, stopCh); err != nil {
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
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
if err = w.engine.VerifyHeader(w.chain, block.Header(), true); err != nil {

View file

@ -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 = 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
)