From f82041b2b60b28adb55647c71629ac94c824587e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 28 Jul 2022 16:14:27 +0300 Subject: [PATCH] eth/catalyst: fix header retrieval, fix sign check --- eth/catalyst/api.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 5ceb9afe58589..c5f2313cabbcc 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -479,12 +479,11 @@ func (api *ConsensusAPI) checkInvalidAncestor(check common.Hash, head common.Has } api.invalidTipsets[head] = invalid } - // if the last valid hash is the terminal pow block, return 0x0 for latest valid hash + // If the last valid hash is the terminal pow block, return 0x0 for latest valid hash lastValid := &invalid.ParentHash - if header := api.eth.BlockChain().GetHeaderByHash(invalid.ParentHash); header != nil && header.Difficulty.BitLen() == 0 { + if header := api.eth.BlockChain().GetHeader(invalid.ParentHash, invalid.Number.Uint64()-1); header != nil && header.Difficulty.Sign() != 0 { lastValid = &common.Hash{} } - failure := "links to previously rejected block" return &beacon.PayloadStatusV1{ Status: beacon.INVALID,