diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index 10d93bebd..498ae67ec 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -587,9 +587,9 @@ func verifyAndSaveNewPoSHeader( currentHeadHash := rawdb.ReadHeadHeaderHash(tx) canExtendCanonical := header.ParentHash == currentHeadHash - canExtendInMemory := cfg.memoryOverlay && (cfg.forkValidator.ExtendingForkHeadHash() == (common.Hash{}) || header.ParentHash == cfg.forkValidator.ExtendingForkHeadHash()) + canExtendFork := cfg.forkValidator.ExtendingForkHeadHash() == (common.Hash{}) || header.ParentHash == cfg.forkValidator.ExtendingForkHeadHash() - if canExtendInMemory || !canExtendCanonical { + if cfg.memoryOverlay && (canExtendFork || !canExtendCanonical) { status, latestValidHash, validationError, criticalError := cfg.forkValidator.ValidatePayload(tx, header, body, canExtendCanonical) if criticalError != nil { return &privateapi.PayloadStatus{CriticalError: criticalError}, false, criticalError @@ -608,11 +608,16 @@ func verifyAndSaveNewPoSHeader( }, success, nil } - // OK, we're on the canonical chain if err := headerInserter.FeedHeaderPoS(tx, header, headerHash); err != nil { return nil, false, err } + if !canExtendCanonical { + log.Info("Side chain or something weird", "parentHash", header.ParentHash, "currentHead", currentHeadHash) + return &privateapi.PayloadStatus{Status: remote.EngineStatus_ACCEPTED}, true, nil + } + + // OK, we're on the canonical chain if requestStatus == engineapi.New { cfg.hd.SetPendingPayloadHash(headerHash) }