aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authorJavier Smooth <iamjaviersmooth@gmail.com>2015-11-13 00:24:47 -0800
committerJavier Smooth <iamjaviersmooth@gmail.com>2015-11-13 00:37:35 -0800
commitbaf101ef4a05ae4d24ed717c16be929456775969 (patch)
tree807afcbc2d1faf2f792a774d72a62ee835934092 /src/cryptonote_core/blockchain.cpp
parentAdjust difficulty target (2 min) and full reward zone (60 kbytes) for block v... (diff)
downloadmonero-baf101ef4a05ae4d24ed717c16be929456775969.tar.xz
More changes for 2-min blocks
Use the correct block time for realtime fuzz on locktime Use the correct block time to calculate next_difficulty on alt chains (will not work as-is with voting) Lock unit tests to original block time for now
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index a24ef8283..e6a233868 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -674,8 +674,8 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
m_timestamps = timestamps;
m_difficulties = difficulties;
}
-
- return next_difficulty(timestamps, difficulties);
+ size_t target = get_current_hard_fork_version() < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET;
+ return next_difficulty(timestamps, difficulties, target);
}
//------------------------------------------------------------------
// This function removes blocks from the blockchain until it gets to the
@@ -865,8 +865,11 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
}
}
+ // FIXME: This will fail if fork activation heights are subject to voting
+ size_t target = get_ideal_hard_fork_version(bei.height) < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET;
+
// calculate the difficulty target for the block and return it
- return next_difficulty(timestamps, cumulative_difficulties);
+ return next_difficulty(timestamps, cumulative_difficulties, target);
}
//------------------------------------------------------------------
// This function does a sanity check on basic things that all miner
@@ -2194,7 +2197,7 @@ bool Blockchain::is_tx_spendtime_unlocked(uint64_t unlock_time) const
{
//interpret as time
uint64_t current_time = static_cast<uint64_t>(time(NULL));
- if(current_time + CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS >= unlock_time)
+ if(current_time + (get_current_hard_fork_version() < 2 ? CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 : CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS) >= unlock_time)
return true;
else
return false;