mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 03:56:36 +00:00
eth/catalyst: allow reorging the head block to a parent
This commit is contained in:
parent
c30c846ce8
commit
2bb95a19a4
1 changed files with 7 additions and 2 deletions
|
|
@ -325,8 +325,13 @@ func (api *ConsensusAPI) forkchoiceUpdated(ctx context.Context, update engine.Fo
|
||||||
// generating the payload. It's a special corner case that a few slots are
|
// generating the payload. It's a special corner case that a few slots are
|
||||||
// missing and we are requested to generate the payload in slot.
|
// missing and we are requested to generate the payload in slot.
|
||||||
} else {
|
} else {
|
||||||
// If the head block is already in our canonical chain, the beacon client is
|
// In EPBs we can reorg to a parent of the head within 32 blocks.
|
||||||
// probably resyncing. Ignore the update.
|
// Allow this once the client is synced.
|
||||||
|
if api.eth.Synced() && api.eth.BlockChain().CurrentBlock().Number.Uint64()-block.NumberU64() < 32 {
|
||||||
|
if latestValid, err := api.eth.BlockChain().SetCanonical(block); err != nil {
|
||||||
|
return engine.ForkChoiceResponse{PayloadStatus: engine.PayloadStatusV1{Status: engine.INVALID, LatestValidHash: &latestValid}}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
log.Info("Ignoring beacon update to old head", "number", block.NumberU64(), "hash", update.HeadBlockHash, "age", common.PrettyAge(time.Unix(int64(block.Time()), 0)), "have", api.eth.BlockChain().CurrentBlock().Number)
|
log.Info("Ignoring beacon update to old head", "number", block.NumberU64(), "hash", update.HeadBlockHash, "age", common.PrettyAge(time.Unix(int64(block.Time()), 0)), "have", api.eth.BlockChain().CurrentBlock().Number)
|
||||||
return valid(nil), nil
|
return valid(nil), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue