mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Fix bug that crashes network with probability 2^-64 (#2358)
This commit is contained in:
parent
e93b380a06
commit
762da8c491
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue