mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-10 21:11:20 +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 {
|
if headerHash == canonicalHash {
|
||||||
log.Info(fmt.Sprintf("[%s] Fork choice on previously known block", s.LogPrefix()))
|
log.Info(fmt.Sprintf("[%s] Fork choice on previously known block", s.LogPrefix()))
|
||||||
cfg.hd.BeaconRequestList.Remove(requestId)
|
cfg.hd.BeaconRequestList.Remove(requestId)
|
||||||
rawdb.WriteForkchoiceHead(tx, forkChoice.HeadBlockHash)
|
// Per the Engine API spec:
|
||||||
canonical, err := safeAndFinalizedBlocksAreCanonical(forkChoice, s, tx, cfg)
|
// Client software MAY skip an update of the forkchoice state and MUST NOT begin a payload build process
|
||||||
if err != nil {
|
// if forkchoiceState.headBlockHash references an ancestor of the head of canonical chain.
|
||||||
log.Warn(fmt.Sprintf("[%s] Fork choice err", s.LogPrefix()), "err", err)
|
// In the case of such an event, client software MUST return
|
||||||
return nil, err
|
// {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}.
|
||||||
}
|
|
||||||
if canonical {
|
|
||||||
return &privateapi.PayloadStatus{
|
return &privateapi.PayloadStatus{
|
||||||
Status: remote.EngineStatus_VALID,
|
Status: remote.EngineStatus_VALID,
|
||||||
LatestValidHash: headerHash,
|
LatestValidHash: headerHash,
|
||||||
}, nil
|
}, nil
|
||||||
} else {
|
|
||||||
return &privateapi.PayloadStatus{
|
|
||||||
CriticalError: &privateapi.InvalidForkchoiceStateErr,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.memoryOverlay && headerHash == cfg.hd.GetNextForkHash() {
|
if cfg.memoryOverlay && headerHash == cfg.hd.GetNextForkHash() {
|
||||||
|
Loading…
Reference in New Issue
Block a user