Fix Re-Org Back into Canonical Chain hive test (#5647)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2022-10-06 18:25:24 +01:00 committed by GitHub
parent ebe63cfa30
commit d95a905b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -470,6 +470,18 @@ func (s *EthBackendServer) getQuickPayloadStatusIfPossible(blockHash common.Hash
log.Debug(fmt.Sprintf("[%s] Downloading some other PoS stuff", prefix), "hash", blockHash)
return &engineapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil
}
// Following code ensures we skip the fork choice state update if if forkchoiceState.headBlockHash references an ancestor of the head of canonical chain
headHash := rawdb.ReadHeadBlockHash(tx)
if err != nil {
return nil, err
}
// We add the extra restriction blockHash != headHash for the FCU case of canonicalHash == blockHash
// because otherwise (when FCU points to the head) we want go to stage headers
// so that it calls writeForkChoiceHashes.
if blockHash != headHash && canonicalHash == blockHash {
return &engineapi.PayloadStatus{Status: remote.EngineStatus_VALID, LatestValidHash: blockHash}, nil
}
}
// If another payload is already commissioned then we just reply with syncing