aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/difficulty.cpp
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-03-31 12:01:19 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-03-31 12:01:19 +0300
commitdf6026182ab1df95a07d01ad54481e7ebf2c69e7 (patch)
tree5b9813551c37b8ad30687e5c2aaae238d2119d5e /src/cryptonote_core/difficulty.cpp
parent8790904cf9ccba56a1cbab51b01f2cbb0a5cb143 (diff)
parent0ee87e63050c31405182042868a89d4f3f3ac7c2 (diff)
downloadmonzero-core-df6026182ab1df95a07d01ad54481e7ebf2c69e7.tar.gz
monzero-core-df6026182ab1df95a07d01ad54481e7ebf2c69e7.tar.xz
monzero-core-df6026182ab1df95a07d01ad54481e7ebf2c69e7.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cryptonote_core/difficulty.cpp')
-rw-r--r--src/cryptonote_core/difficulty.cpp6
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;
}