aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/hardfork.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-12-22 10:10:36 +0200
committerRiccardo Spagni <ric@spagni.net>2015-12-22 10:10:54 +0200
commitaa7d6c5412da29ec39bb4c9aaba7e45633d27547 (patch)
tree3c85a553792605403878aa5e06067c641318a125 /src/cryptonote_core/hardfork.cpp
parentMerge pull request #546 (diff)
parentAllow the wallet to access hard fork information (diff)
downloadmonero-aa7d6c5412da29ec39bb4c9aaba7e45633d27547.tar.xz
Merge pull request #547
8ea7af1 Allow the wallet to access hard fork information (moneromooo-monero) 760331b epee: make log macros behave like statements (moneromooo-monero) 3f2970f Add missing semicolons after log statements (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core/hardfork.cpp')
-rw-r--r--src/cryptonote_core/hardfork.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cryptonote_core/hardfork.cpp b/src/cryptonote_core/hardfork.cpp
index 550047289..9bd4a337c 100644
--- a/src/cryptonote_core/hardfork.cpp
+++ b/src/cryptonote_core/hardfork.cpp
@@ -355,7 +355,16 @@ uint8_t HardFork::get_ideal_version(uint64_t height) const
return original_version;
}
-bool HardFork::get_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint8_t &voting) const
+uint64_t HardFork::get_earliest_ideal_height_for_version(uint8_t version) const
+{
+ for (unsigned int n = heights.size() - 1; n > 0; --n) {
+ if (heights[n].version <= version)
+ return heights[n].height;
+ }
+ return 0;
+}
+
+bool HardFork::get_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint64_t &earliest_height, uint8_t &voting) const
{
CRITICAL_REGION_LOCAL(lock);
@@ -367,6 +376,7 @@ bool HardFork::get_voting_info(uint8_t version, uint32_t &window, uint32_t &vote
votes += last_versions[n];
threshold = (window * heights[current_version].threshold + 99) / 100;
assert((votes >= threshold) == enabled);
+ earliest_height = get_earliest_ideal_height_for_version(version);
voting = heights.back().version;
return enabled;
}