mirror of
https://github.com/jwinterm/aeon.git
synced 2026-10-22 05:58:33 +02:00
integration test for hard fork 1 changes
This commit is contained in:
@@ -89,7 +89,12 @@ namespace cryptonote {
|
||||
return !carry;
|
||||
}
|
||||
|
||||
difficulty_type next_difficulty(vector<uint64_t> timestamps, vector<difficulty_type> cumulative_difficulties, size_t target_seconds) {
|
||||
difficulty_type next_difficulty(vector<uint64_t> timestamps, vector<difficulty_type> cumulative_difficulties, size_t height) {
|
||||
size_t target_seconds = DIFFICULTY_TARGET;
|
||||
|
||||
if (height < HARDFORK_1_HEIGHT)
|
||||
target_seconds = HARDFORK_1_OLD_TARGET;
|
||||
|
||||
//cutoff DIFFICULTY_LAG
|
||||
if(timestamps.size() > DIFFICULTY_WINDOW)
|
||||
{
|
||||
@@ -127,11 +132,14 @@ namespace cryptonote {
|
||||
if (high != 0 || low + time_span - 1 < low) {
|
||||
return 0;
|
||||
}
|
||||
return (low + time_span - 1) / time_span;
|
||||
|
||||
difficulty_type new_diff = (low + time_span - 1) / time_span;
|
||||
|
||||
if (height >= HARDFORK_1_HEIGHT && height < HARDFORK_1_HEIGHT+HARDFORK_1_DIFFADJ_WINDOW) {
|
||||
new_diff += new_diff*(HARDFORK_1_HEIGHT+HARDFORK_1_DIFFADJ_WINDOW-height)*(HARDFORK_1_DIFFADJ-1)/HARDFORK_1_DIFFADJ_WINDOW;
|
||||
}
|
||||
|
||||
return new_diff;
|
||||
}
|
||||
|
||||
difficulty_type next_difficulty(vector<uint64_t> timestamps, vector<difficulty_type> cumulative_difficulties)
|
||||
{
|
||||
return next_difficulty(std::move(timestamps), std::move(cumulative_difficulties), DIFFICULTY_TARGET);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user