Skip to content

Commit

Permalink
Merge tari-project#2179: Fix geometric mean comparison halting the bl…
Browse files Browse the repository at this point in the history
…ockchain

When geometric mean of a new block is compared to that of the network, it must
be accepted if it is equal, due to the number being rounded. `geo_mean =
sqrt(achieved_difficulty_01 ^ 2 x achieved_difficulty_02 ^ 2)` (tari-project#2179) Merge
pull request tari-project#2179
  • Loading branch information
stringhandler committed Aug 28, 2020
2 parents 2e415c8 + 8395b5f commit 6ae1a54
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<B: BlockchainBackend> Validation<Difficulty, B> for AccumDifficultyValidato
let tip_header = db
.fetch_last_header()?
.ok_or_else(|| ValidationError::custom_error("Cannot retrieve tip header. Blockchain DB is empty"))?;
if *accum_difficulty <= tip_header.total_accumulated_difficulty_inclusive() {
if *accum_difficulty < tip_header.total_accumulated_difficulty_inclusive() {
return Err(ValidationError::WeakerAccumulatedDifficulty);
}
Ok(())
Expand Down

0 comments on commit 6ae1a54

Please sign in to comment.