Skip to content

Commit

Permalink
eth/catalyst: return 0x0 if latestvalid is pow block
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden authored and karalabe committed Jul 28, 2022
1 parent f354981 commit 3ea4a60
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,16 @@ 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().GetHeaderByHash(invalid.ParentHash); header != nil && header.Difficulty.BitLen() == 0 {
lastValid = nil
}

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 3ea4a60

Please sign in to comment.