From fc9d0deb387e17ad820ce44a5633bb9b6505c965 Mon Sep 17 00:00:00 2001 From: wowario Date: Fri, 9 Nov 2018 19:09:29 +0300 Subject: [PATCH] update difficulty minimum and guess --- src/cryptonote_basic/difficulty.cpp | 10 ++++++++-- src/cryptonote_config.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index 688164424..c84fff7a5 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -296,7 +296,7 @@ namespace cryptonote { assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 ); - if ( height <= DIFFICULTY_HEIGHT + 1 + N ) { return DIFFICULTY_GUESS; } + if ( height <= DIFFICULTY_HEIGHT + 1 ) { return DIFFICULTY_GUESS; } // Safely convert out-of-sequence timestamps into > 0 solvetimes. std::vectorTS(N+1); @@ -344,6 +344,12 @@ namespace cryptonote { if ( next_D > 100000 ) { next_D = ((next_D+500)/1000)*1000 + std::min(static_cast(999), (TS[N]-TS[N-10])/10); } - return next_D; + + if ( next_D < DIFFICULTY_MINIMUM ) { + return static_cast(DIFFICULTY_MINIMUM); + } + else { + return static_cast(next_D); + } } } diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 17b0aaa10..ebf8a020f 100755 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -83,8 +83,8 @@ #define DIFFICULTY_BLOCKS_COUNT_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N #define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG #define DIFFICULTY_HEIGHT 63469 // v10 fork height -#define DIFFICULTY_GUESS 40000000 // difficulty at fork 40m -#define DIFFICULTY_MINIMUM 25000000 // minimum difficulty set to 25m +#define DIFFICULTY_GUESS 100000069 // difficulty at fork 100m +#define DIFFICULTY_MINIMUM 40000069 // minimum difficulty set to 40m #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS