Unverified Commit 2c6f1269 authored by Jakub Sztandera's avatar Jakub Sztandera
Browse files

Fix challange counts


Signed-off-by: default avatarJakub Sztandera <kubuxu@protocol.ai>
parent 0cbb2c48
...@@ -9,10 +9,10 @@ const SectorChallengeRatioDiv = 25 ...@@ -9,10 +9,10 @@ const SectorChallengeRatioDiv = 25
const MaxFallbackPostChallengeCount = 10 const MaxFallbackPostChallengeCount = 10
// extracted from lotus/chain/types/blockheader // extracted from lotus/chain/types/blockheader
func ElectionPostChallengeCount(sectors uint64, faults int) uint64 { func ElectionPostChallengeCount(sectors uint64, faults uint64) uint64 {
if sectors == 0 { if sectors-faults == 0 {
return 0 return 0
} }
// ceil(sectors / SectorChallengeRatioDiv) // ceil(sectors / SectorChallengeRatioDiv)
return (sectors-uint64(faults)-1)/SectorChallengeRatioDiv + 1 return (sectors-faults-1)/SectorChallengeRatioDiv + 1
} }
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