diff options
author | Thomas Winget <tewinget@gmail.com> | 2015-10-07 22:28:43 -0400 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2016-03-24 03:39:52 -0400 |
commit | 8ac329df0294f16efbc48a2785eda165878d3511 (patch) | |
tree | 6529e23da88cf72f22a7380af1db9fd02dd66f41 /src/cryptonote_core/difficulty.cpp | |
parent | Move checkpoint functions into checkpoints class (diff) | |
download | monero-8ac329df0294f16efbc48a2785eda165878d3511.tar.xz |
doxygen documentation for difficulty functions
Diffstat (limited to 'src/cryptonote_core/difficulty.cpp')
-rw-r--r-- | src/cryptonote_core/difficulty.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cryptonote_core/difficulty.cpp b/src/cryptonote_core/difficulty.cpp index 236e84481..54da77392 100644 --- a/src/cryptonote_core/difficulty.cpp +++ b/src/cryptonote_core/difficulty.cpp @@ -116,8 +116,8 @@ namespace cryptonote { return !carry; } - difficulty_type next_difficulty(vector<uint64_t> timestamps, vector<difficulty_type> cumulative_difficulties, size_t target_seconds) { - //cutoff DIFFICULTY_LAG + difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds) { + if(timestamps.size() > DIFFICULTY_WINDOW) { timestamps.resize(DIFFICULTY_WINDOW); @@ -151,6 +151,8 @@ namespace cryptonote { assert(total_work > 0); uint64_t low, high; mul(total_work, target_seconds, low, high); + // blockchain errors "difficulty overhead" if this function returns zero. + // TODO: consider throwing an exception instead if (high != 0 || low + time_span - 1 < low) { return 0; } |