Skip to content

Commit

Permalink
eth/catalyst: return 0x0 if latestvalid is pow block (ethereum#25423)
Browse files Browse the repository at this point in the history
* 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: Péter Szilágyi <[email protected]>
  • Loading branch information
2 people authored and cp-wjhan committed Oct 10, 2023
1 parent 702cb08 commit c2342e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,15 @@ 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
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"
return &beacon.PayloadStatusV1{
Status: beacon.INVALID,
LatestValidHash: &invalid.ParentHash,
LatestValidHash: lastValid,
ValidationError: &failure,
}
}
Expand Down

0 comments on commit c2342e3

Please sign in to comment.