aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/hardfork.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-11-09 21:22:32 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-11-10 09:45:51 +0000
commit2f254ff5999f1b814a91c33f982cb2fc0844ec66 (patch)
treed18eed234c70ae166640d0de21a956ec74f6263e /src/cryptonote_core/hardfork.cpp
parenthardfork: allow per-fork voting thresholds (diff)
downloadmonero-2f254ff5999f1b814a91c33f982cb2fc0844ec66.tar.xz
hardfork: add a get_ideal_version(uint64_t) function
It returns the ideal version for a given height, which is based on the minimum height for a fork, disregarding votes
Diffstat (limited to 'src/cryptonote_core/hardfork.cpp')
-rw-r--r--src/cryptonote_core/hardfork.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cryptonote_core/hardfork.cpp b/src/cryptonote_core/hardfork.cpp
index 45d623ca9..edc2f33a9 100644
--- a/src/cryptonote_core/hardfork.cpp
+++ b/src/cryptonote_core/hardfork.cpp
@@ -337,6 +337,17 @@ uint8_t HardFork::get_ideal_version() const
return heights.back().version;
}
+uint8_t HardFork::get_ideal_version(uint64_t height) const
+{
+ CRITICAL_REGION_LOCAL(lock);
+ for (unsigned int n = heights.size() - 1; n > 0; --n) {
+ if (height >= heights[n].height) {
+ return heights[n].version;
+ }
+ }
+ return original_version;
+}
+
bool HardFork::get_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint8_t &voting) const
{
CRITICAL_REGION_LOCAL(lock);