From 7f28f73bd6d0578b7501f77b8c20c848659eb9a3 Mon Sep 17 00:00:00 2001 From: wowario Date: Fri, 9 Nov 2018 13:02:08 +0300 Subject: [PATCH] Difficulty: temper long solvetime --- src/cryptonote_basic/difficulty.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index 927e1baf7..688164424 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -295,7 +295,7 @@ namespace cryptonote { uint64_t L(0), ST(0), next_D, prev_D, avg_D, i; assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 ); - + if ( height <= DIFFICULTY_HEIGHT + 1 + N ) { return DIFFICULTY_GUESS; } // Safely convert out-of-sequence timestamps into > 0 solvetimes. @@ -307,9 +307,9 @@ namespace cryptonote { } for ( i = 1; i <= N; i++) { - // Ignore long solvetimes if they were preceeded by 3 or 6 fast solves. - if ( i > 4 && TS[i]-TS[i-1] > 4*T && TS[i-1] - TS[i-4] < (16*T)/10 ) { ST = 2*T; } - else if ( i > 7 && TS[i]-TS[i-1] > 4*T && TS[i-1] - TS[i-7] < 4*T ) { ST = 2*T; } + // Temper long solvetime drops if they were preceded by 3 or 6 fast solves. + if ( i > 4 && TS[i]-TS[i-1] > 5*T && TS[i-1] - TS[i-4] < (14*T)/10 ) { ST = 2*T; } + else if ( i > 7 && TS[i]-TS[i-1] > 5*T && TS[i-1] - TS[i-7] < 4*T ) { ST = 2*T; } else { // Assume normal conditions, so get ST. // LWMA drops too much from long ST, so limit drops with a 5*T limit ST = std::min(5*T ,TS[i] - TS[i-1]);