From 59521937bf3234919ee76110cabd76fd2878361f Mon Sep 17 00:00:00 2001 From: wowario Date: Thu, 26 Jan 2023 00:23:41 +0300 Subject: [PATCH] hard code diff --- src/cryptonote_basic/difficulty.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index dd0b8d83c..134611b47 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -215,6 +215,9 @@ namespace cryptonote { if (length <= 1) { return 1; } + if (HEIGHT < 130) { + return 100; + } static_assert(DIFFICULTY_WINDOW >= 2, "Window is too small"); assert(length <= DIFFICULTY_WINDOW); sort(timestamps.begin(), timestamps.end()); @@ -261,6 +264,9 @@ namespace cryptonote { difficulty_type next_difficulty_v2(std::vector timestamps, std::vector cumulative_difficulties, size_t target_seconds, uint64_t HEIGHT) { const int64_t T = static_cast(target_seconds); size_t N = DIFFICULTY_WINDOW_V2; + if (HEIGHT < 130) { + return 100; + } if (timestamps.size() < 4) { return 1; } else if ( timestamps.size() < N+1 ) { @@ -295,6 +301,9 @@ namespace cryptonote { int64_t T = DIFFICULTY_TARGET_V2; int64_t N = DIFFICULTY_WINDOW_V2; int64_t L(0), ST, sum_3_ST(0), next_D, prev_D; + if (HEIGHT < 130) { + return 100; + } assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= static_cast(N+1) ); for ( int64_t i = 1; i <= N; i++ ) { ST = static_cast(timestamps[i]) - static_cast(timestamps[i-1]); @@ -318,6 +327,9 @@ namespace cryptonote { uint64_t T = DIFFICULTY_TARGET_V2; uint64_t N = DIFFICULTY_WINDOW_V2; uint64_t L(0), ST(0), next_D, prev_D, avg_D, i; + if (HEIGHT < 130) { + return 100; + } assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 ); std::vectorTS(N+1); TS[0] = timestamps[0]; @@ -363,6 +375,9 @@ namespace cryptonote { difficulty_type next_difficulty_v5(std::vector timestamps, std::vector cumulative_difficulties, uint64_t HEIGHT) { uint64_t T = DIFFICULTY_TARGET_V2; uint64_t N = DIFFICULTY_WINDOW_V3; + if (HEIGHT < 130) { + return 100; + } assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 ); assert(timestamps.size() == N+1);