mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
sleep time when fetch receive future block
This commit is contained in:
parent
3268d372a0
commit
de7c60ed49
1 changed files with 5 additions and 0 deletions
|
|
@ -650,6 +650,7 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
|
|||
log.Debug("Unknown parent of propagated block", "peer", peer, "number", block.Number(), "hash", hash, "parent", block.ParentHash())
|
||||
return
|
||||
}
|
||||
again:
|
||||
// Quickly validate the header and propagate the block if it passes
|
||||
switch err := f.verifyHeader(block.Header()); err {
|
||||
case nil:
|
||||
|
|
@ -657,6 +658,10 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
|
|||
propBroadcastOutTimer.UpdateSince(block.ReceivedAt)
|
||||
go f.broadcastBlock(block, true)
|
||||
case consensus.ErrFutureBlock:
|
||||
delay := time.Unix(block.Time().Int64(), 0).Sub(time.Now()) // nolint: gosimple
|
||||
time.Sleep(delay)
|
||||
log.Info("Receive futrue block", "number", block.NumberU64(), "hash", block.Hash().Hex(), "delay", delay)
|
||||
goto again
|
||||
case consensus.ErrMissingValidatorSignature:
|
||||
newBlock := block
|
||||
if f.appendM2HeaderHook != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue