integration test for hard fork 1 changes

This commit is contained in:
Javier Smooth
2015-05-06 00:12:31 -07:00
parent 407a9ae98d
commit 270c995a4b
16 changed files with 67 additions and 38 deletions
+14 -6
View File
@@ -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);
}
}