mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-10 13:01:21 +00:00
Don't write headBlockHash & co when FCU points to an old canonical block (#4650)
This commit is contained in:
parent
d9cb87a149
commit
f05401b78e
@ -332,22 +332,15 @@ func startHandlingForkChoice(
|
||||
if headerHash == canonicalHash {
|
||||
log.Info(fmt.Sprintf("[%s] Fork choice on previously known block", s.LogPrefix()))
|
||||
cfg.hd.BeaconRequestList.Remove(requestId)
|
||||
rawdb.WriteForkchoiceHead(tx, forkChoice.HeadBlockHash)
|
||||
canonical, err := safeAndFinalizedBlocksAreCanonical(forkChoice, s, tx, cfg)
|
||||
if err != nil {
|
||||
log.Warn(fmt.Sprintf("[%s] Fork choice err", s.LogPrefix()), "err", err)
|
||||
return nil, err
|
||||
}
|
||||
if canonical {
|
||||
// Per the Engine API spec:
|
||||
// Client software MAY skip an update of the forkchoice state and MUST NOT begin a payload build process
|
||||
// if forkchoiceState.headBlockHash references an ancestor of the head of canonical chain.
|
||||
// In the case of such an event, client software MUST return
|
||||
// {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}.
|
||||
return &privateapi.PayloadStatus{
|
||||
Status: remote.EngineStatus_VALID,
|
||||
LatestValidHash: headerHash,
|
||||
}, nil
|
||||
} else {
|
||||
return &privateapi.PayloadStatus{
|
||||
CriticalError: &privateapi.InvalidForkchoiceStateErr,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.memoryOverlay && headerHash == cfg.hd.GetNextForkHash() {
|
||||
|
Loading…
Reference in New Issue
Block a user