From 52c4846b26fa39315ae63471363590a26117a024 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo <giulio.rebuffo@gmail.com> Date: Wed, 18 May 2022 21:33:35 +0200 Subject: [PATCH] deprecated old status (#4196) --- ethdb/privateapi/ethbackend.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethdb/privateapi/ethbackend.go b/ethdb/privateapi/ethbackend.go index 42450384a2..de59739a37 100644 --- a/ethdb/privateapi/ethbackend.go +++ b/ethdb/privateapi/ethbackend.go @@ -333,7 +333,7 @@ func (s *EthBackendServer) EngineNewPayloadV1(ctx context.Context, req *types2.E } if parentTd != nil && parentTd.Cmp(s.config.TerminalTotalDifficulty) < 0 { log.Warn("[NewPayload] TTD not reached yet", "height", header.Number, "hash", common.Hash(blockHash)) - return &remote.EnginePayloadStatus{Status: remote.EngineStatus_INVALID_TERMINAL_BLOCK}, nil + return &remote.EnginePayloadStatus{Status: remote.EngineStatus_INVALID}, nil } tx.Rollback() @@ -453,7 +453,7 @@ func (s *EthBackendServer) EngineForkChoiceUpdatedV1(ctx context.Context, req *r if td != nil && td.Cmp(s.config.TerminalTotalDifficulty) < 0 { log.Warn("[ForkChoiceUpdated] TTD not reached yet", "forkChoice", forkChoice) return &remote.EngineForkChoiceUpdatedReply{ - PayloadStatus: &remote.EnginePayloadStatus{Status: remote.EngineStatus_INVALID_TERMINAL_BLOCK}, + PayloadStatus: &remote.EnginePayloadStatus{Status: remote.EngineStatus_INVALID}, }, nil } @@ -507,6 +507,9 @@ func (s *EthBackendServer) EngineForkChoiceUpdatedV1(ctx context.Context, req *r return nil, fmt.Errorf("unexpected head hash: %x vs %x", headHeader.Hash(), forkChoice.HeadBlockHash) } + if headHeader.Time > req.PayloadAttributes.Timestamp { + return nil, fmt.Errorf("timestamp is too low") + } emptyHeader := core.MakeEmptyHeader(headHeader, s.config, req.PayloadAttributes.Timestamp, nil) emptyHeader.Coinbase = gointerfaces.ConvertH160toAddress(req.PayloadAttributes.SuggestedFeeRecipient) emptyHeader.MixDigest = gointerfaces.ConvertH256ToHash(req.PayloadAttributes.PrevRandao) -- GitLab