diff --git a/chain/types/blockheader.go b/chain/types/blockheader.go index 9d3c0a4b3..e44ca54b4 100644 --- a/chain/types/blockheader.go +++ b/chain/types/blockheader.go @@ -214,8 +214,11 @@ func IsTicketWinner(partialTicket []byte, ssizeI uint64, snum uint64, totpow Big } func ElectionPostChallengeCount(sectors uint64) uint64 { + if sectors == 0 { + return 0 + } // ceil(sectors / build.SectorChallengeRatioDiv) - return (sectors + build.SectorChallengeRatioDiv - 1) / build.SectorChallengeRatioDiv + return (sectors-1)/build.SectorChallengeRatioDiv + 1 } func (t *Ticket) Equals(ot *Ticket) bool {