hard code diff #454

Merged
wowario merged 1 commits from wowario/wownero:testnet-v11 into testnet-v11 1 year ago

@ -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<uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds, uint64_t HEIGHT) {
const int64_t T = static_cast<int64_t>(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<uint64_t>(N+1) );
for ( int64_t i = 1; i <= N; i++ ) {
ST = static_cast<int64_t>(timestamps[i]) - static_cast<int64_t>(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::vector<uint64_t>TS(N+1);
TS[0] = timestamps[0];
@ -363,6 +375,9 @@ namespace cryptonote {
difficulty_type next_difficulty_v5(std::vector<uint64_t> timestamps, std::vector<difficulty_type> 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);

Loading…
Cancel
Save