Fix bug that crashes network with probability 2^-64
@@ -383,7 +383,7 @@ impl Proof {
/// Difficulty achieved by this proof with given scaling factor
fn scaled_difficulty(&self, scale: u64) -> u64 {
- let diff = ((scale as u128) << 64) / (self.hash().to_u64() as u128);
+ let diff = ((scale as u128) << 64) / (max(1, self.hash().to_u64()) as u128);
min(diff, <u64>::max_value() as u128) as u64
}
}
