Handling of already canonical payloads (#4367)

* deprecated ACCEPTED status

* pre-check for existing canonical header
This commit is contained in:
Giulio rebuffo 2022-06-05 14:16:52 +02:00 committed by GitHub
parent 1231f8c21c
commit df80b0d915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -418,6 +418,22 @@ func handleNewPayload(
return err
}
isCanonicalHeader, err := rawdb.IsCanonicalHash(tx, headerHash)
if err != nil {
return err
}
// If we already processed this block as canonical we return VALID and skip it.
if isCanonicalHeader {
if requestStatus == engineapi.New {
cfg.hd.PayloadStatusCh <- privateapi.PayloadStatus{
Status: remote.EngineStatus_VALID,
LatestValidHash: rawdb.ReadHeadBlockHash(tx),
}
}
return nil
}
if existingCanonicalHash != (common.Hash{}) && headerHash == existingCanonicalHash {
log.Info(fmt.Sprintf("[%s] New payload: previously received valid header", s.LogPrefix()))
cfg.hd.BeaconRequestList.Remove(requestId)