mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
hard code diff
This commit is contained in:
parent
225e079087
commit
59521937bf
1 changed files with 15 additions and 0 deletions
|
@ -215,6 +215,9 @@ namespace cryptonote {
|
||||||
if (length <= 1) {
|
if (length <= 1) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (HEIGHT < 130) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
static_assert(DIFFICULTY_WINDOW >= 2, "Window is too small");
|
static_assert(DIFFICULTY_WINDOW >= 2, "Window is too small");
|
||||||
assert(length <= DIFFICULTY_WINDOW);
|
assert(length <= DIFFICULTY_WINDOW);
|
||||||
sort(timestamps.begin(), timestamps.end());
|
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) {
|
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);
|
const int64_t T = static_cast<int64_t>(target_seconds);
|
||||||
size_t N = DIFFICULTY_WINDOW_V2;
|
size_t N = DIFFICULTY_WINDOW_V2;
|
||||||
|
if (HEIGHT < 130) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
if (timestamps.size() < 4) {
|
if (timestamps.size() < 4) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if ( timestamps.size() < N+1 ) {
|
} else if ( timestamps.size() < N+1 ) {
|
||||||
|
@ -295,6 +301,9 @@ namespace cryptonote {
|
||||||
int64_t T = DIFFICULTY_TARGET_V2;
|
int64_t T = DIFFICULTY_TARGET_V2;
|
||||||
int64_t N = DIFFICULTY_WINDOW_V2;
|
int64_t N = DIFFICULTY_WINDOW_V2;
|
||||||
int64_t L(0), ST, sum_3_ST(0), next_D, prev_D;
|
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) );
|
assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= static_cast<uint64_t>(N+1) );
|
||||||
for ( int64_t i = 1; i <= N; i++ ) {
|
for ( int64_t i = 1; i <= N; i++ ) {
|
||||||
ST = static_cast<int64_t>(timestamps[i]) - static_cast<int64_t>(timestamps[i-1]);
|
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 T = DIFFICULTY_TARGET_V2;
|
||||||
uint64_t N = DIFFICULTY_WINDOW_V2;
|
uint64_t N = DIFFICULTY_WINDOW_V2;
|
||||||
uint64_t L(0), ST(0), next_D, prev_D, avg_D, i;
|
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 );
|
assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 );
|
||||||
std::vector<uint64_t>TS(N+1);
|
std::vector<uint64_t>TS(N+1);
|
||||||
TS[0] = timestamps[0];
|
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) {
|
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 T = DIFFICULTY_TARGET_V2;
|
||||||
uint64_t N = DIFFICULTY_WINDOW_V3;
|
uint64_t N = DIFFICULTY_WINDOW_V3;
|
||||||
|
if (HEIGHT < 130) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 );
|
assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 );
|
||||||
|
|
||||||
assert(timestamps.size() == N+1);
|
assert(timestamps.size() == N+1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue