Quick fix for graph_weight used with AR PoW (#2042)

This commit is contained in:
Ignotus Peverell 2018-11-28 20:33:46 -08:00 committed by GitHub
parent 28e0d97e64
commit e356280841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,7 +178,7 @@ pub const DAMP_FACTOR: u64 = 3;
pub fn graph_weight(height: u64, edge_bits: u8) -> u64 { pub fn graph_weight(height: u64, edge_bits: u8) -> u64 {
let mut xpr_edge_bits = edge_bits as 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; let expiry_height = (1 << bits_over_min) * YEAR_HEIGHT;
if height >= expiry_height { if height >= expiry_height {
xpr_edge_bits = xpr_edge_bits.saturating_sub(1 + (height - expiry_height) / WEEK_HEIGHT); xpr_edge_bits = xpr_edge_bits.saturating_sub(1 + (height - expiry_height) / WEEK_HEIGHT);