Less truncation in difficulty calculation
@@ -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)))
}
