aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-08-16 14:40:32 +0200
committerRiccardo Spagni <ric@spagni.net>2016-08-16 14:40:32 +0200
commit40e8c6c403a78eeaf6367ea9cf3f5d76c266f30d (patch)
tree62d2516871b61424612f8b6f5bd5dc52d3345a42 /src/cryptonote_core
parentMerge pull request #955 (diff)
parentdaemon: print time to next fork (diff)
downloadmonero-40e8c6c403a78eeaf6367ea9cf3f5d76c266f30d.tar.xz
Merge pull request #959
7e4e002 daemon: print time to next fork (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/blockchain.h7
-rw-r--r--src/cryptonote_core/hardfork.cpp12
-rw-r--r--src/cryptonote_core/hardfork.h7
3 files changed, 26 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h
index f5950291c..1524693b8 100644
--- a/src/cryptonote_core/blockchain.h
+++ b/src/cryptonote_core/blockchain.h
@@ -667,6 +667,13 @@ namespace cryptonote
uint8_t get_ideal_hard_fork_version() const { return m_hardfork->get_ideal_version(); }
/**
+ * @brief returns the next hardfork version
+ *
+ * @return the version
+ */
+ uint8_t get_next_hard_fork_version() const { return m_hardfork->get_next_version(); }
+
+ /**
* @brief returns the newest hardfork version voted to be enabled
* as of a certain height
*
diff --git a/src/cryptonote_core/hardfork.cpp b/src/cryptonote_core/hardfork.cpp
index 39c026b08..c63ca36ef 100644
--- a/src/cryptonote_core/hardfork.cpp
+++ b/src/cryptonote_core/hardfork.cpp
@@ -369,6 +369,18 @@ uint64_t HardFork::get_earliest_ideal_height_for_version(uint8_t version) const
return 0;
}
+uint8_t HardFork::get_next_version() const
+{
+ CRITICAL_REGION_LOCAL(lock);
+ uint64_t height = db.height();
+ for (unsigned int n = heights.size() - 1; n > 0; --n) {
+ if (height >= heights[n].height) {
+ return heights[n < heights.size() - 1 ? n + 1 : n].version;
+ }
+ }
+ return original_version;
+}
+
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);
diff --git a/src/cryptonote_core/hardfork.h b/src/cryptonote_core/hardfork.h
index b3d485878..33b958f9c 100644
--- a/src/cryptonote_core/hardfork.h
+++ b/src/cryptonote_core/hardfork.h
@@ -169,6 +169,13 @@ namespace cryptonote
uint8_t get_ideal_version(uint64_t height) const;
/**
+ * @brief returns the next version
+ *
+ * This is the version which will we fork to next
+ */
+ uint8_t get_next_version() const;
+
+ /**
* @brief returns the current version
*
* This is the latest version that's past its trigger date and had enough votes