Unverified Commit 377c7d79 authored by Marius van der Wijden's avatar Marius van der Wijden Committed by GitHub

eth/catalyst: return 0x0 if latestvalid is pow block (#25423)

* eth/catalyst: return 0x0 if latestvalid is pow block

* eth/catalyst: return 0x0 if latestvalid is pow block

* eth/catalyst: fix header retrieval, fix sign check
Co-authored-by: 's avatarPéter Szilágyi <peterke@gmail.com>
parent f3549814
...@@ -479,10 +479,15 @@ func (api *ConsensusAPI) checkInvalidAncestor(check common.Hash, head common.Has ...@@ -479,10 +479,15 @@ func (api *ConsensusAPI) checkInvalidAncestor(check common.Hash, head common.Has
} }
api.invalidTipsets[head] = invalid api.invalidTipsets[head] = invalid
} }
// If the last valid hash is the terminal pow block, return 0x0 for latest valid hash
lastValid := &invalid.ParentHash
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" failure := "links to previously rejected block"
return &beacon.PayloadStatusV1{ return &beacon.PayloadStatusV1{
Status: beacon.INVALID, Status: beacon.INVALID,
LatestValidHash: &invalid.ParentHash, LatestValidHash: lastValid,
ValidationError: &failure, ValidationError: &failure,
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment