Merge pull request #16 from wowario/patch-2

Update LWMA difficulty algorithm
This commit is contained in:
jw 2018-04-23 08:28:58 -07:00 committed by GitHub
commit 7d928031f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,7 @@ namespace cryptonote {
uint64_t difficulty(0), next_difficulty(0); uint64_t difficulty(0), next_difficulty(0);
// Loop through N most recent blocks. N is most recently solved block. // Loop through N most recent blocks. N is most recently solved block.
for (size_t i = 1; i <= N; i++) { for (int64_t i = 1; i <= N; i++) {
solveTime = static_cast<int64_t>(timestamps[i]) - static_cast<int64_t>(timestamps[i - 1]); solveTime = static_cast<int64_t>(timestamps[i]) - static_cast<int64_t>(timestamps[i - 1]);
solveTime = std::min<int64_t>((T * 7), std::max<int64_t>(solveTime, (-7 * T))); solveTime = std::min<int64_t>((T * 7), std::max<int64_t>(solveTime, (-7 * T)));
difficulty = cumulative_difficulties[i] - cumulative_difficulties[i - 1]; difficulty = cumulative_difficulties[i] - cumulative_difficulties[i - 1];