From e35628084167817c9a5e49d68822d19ac9dba5c1 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Wed, 28 Nov 2018 20:33:46 -0800 Subject: [PATCH] Quick fix for graph_weight used with AR PoW (#2042) --- core/src/consensus.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/consensus.rs b/core/src/consensus.rs index 3f1ca82b2..d396ed039 100644 --- a/core/src/consensus.rs +++ b/core/src/consensus.rs @@ -178,7 +178,7 @@ pub const DAMP_FACTOR: u64 = 3; pub fn graph_weight(height: u64, edge_bits: u8) -> u64 { let mut xpr_edge_bits = edge_bits as u64; - let bits_over_min = edge_bits - global::min_edge_bits(); + let bits_over_min = edge_bits.saturating_sub(global::min_edge_bits()); let expiry_height = (1 << bits_over_min) * YEAR_HEIGHT; if height >= expiry_height { xpr_edge_bits = xpr_edge_bits.saturating_sub(1 + (height - expiry_height) / WEEK_HEIGHT);