Less truncation in difficulty calculation (#1116)

This commit is contained in:
Ignotus Peverell
2018-06-22 22:30:02 +01:00
committed by GitHub
parent a5553ebba5
commit 24cd5bc3e3
+1 -4
View File
@@ -239,10 +239,7 @@ where
ts_damp
};
// AVOID BREAKING CONSENSUS FOR NOW WITH OLD DOUBLE TRUNCATION CALC
let difficulty = (diff_sum / DIFFICULTY_ADJUST_WINDOW) * BLOCK_TIME_WINDOW / adj_ts;
// EVENTUALLY BREAK CONSENSUS WITH THIS IMPROVED SINGLE TRUNCATION DIFF CALC
// let difficulty = diff_sum * BLOCK_TIME_SEC / adj_ts;
let difficulty = diff_sum * BLOCK_TIME_SEC / adj_ts;
Ok(Difficulty::from_num(max(difficulty, 1)))
}