Skip to content

Commit

Permalink
Fix Re-Org Back into Canonical Chain hive test (erigontech#5647)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
  • Loading branch information
AlexeyAkhunov and Alexey Sharp authored Oct 6, 2022
1 parent ebe63cf commit d95a905
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ethdb/privateapi/ethbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d95a905

Please sign in to comment.