aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-07-13 21:19:05 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-07-13 21:38:34 +0100
commitd7b681cd6518834ce9b76676980561cb8e235cff (patch)
tree51ff9d28bb4be6e929fd3440613932dbb039900c /src/cryptonote_core
parentMerge pull request #889 (diff)
downloadmonero-d7b681cd6518834ce9b76676980561cb8e235cff.tar.xz
remove hf_starting_height db
It's not really needed, it used to be an optimization for when that code was not using the db and needed to recalculate things fast on startup.
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/hardfork.cpp23
-rw-r--r--src/cryptonote_core/hardfork.h7
2 files changed, 6 insertions, 24 deletions
diff --git a/src/cryptonote_core/hardfork.cpp b/src/cryptonote_core/hardfork.cpp
index 7e2e82c4a..d3262dbe3 100644
--- a/src/cryptonote_core/hardfork.cpp
+++ b/src/cryptonote_core/hardfork.cpp
@@ -137,10 +137,6 @@ bool HardFork::add(uint8_t block_version, uint8_t voting_version, uint64_t heigh
uint8_t voted = get_voted_fork_index(height + 1);
if (voted > current_fork_index) {
- for (int v = heights[current_fork_index].version + 1; v <= heights[voted].version; ++v) {
- // we reached the vote threshold with this block, next one will be forked
- db.set_hard_fork_starting_height(v, height + 1);
- }
current_fork_index = voted;
}
@@ -172,7 +168,12 @@ void HardFork::init()
else
height = 1;
- bool populate = db.get_hard_fork_starting_height(original_version) == std::numeric_limits<uint64_t>::max();
+ bool populate = false;
+ try
+ {
+ db.get_hard_fork_version(0);
+ }
+ catch (...) { populate = true; }
if (populate) {
LOG_PRINT_L0("The DB has no hard fork info, reparsing from start");
height = 1;
@@ -182,7 +183,6 @@ void HardFork::init()
reorganize_from_chain_height(height);
// reorg will not touch the genesis block, use this as a flag for populating done
db.set_hard_fork_version(0, original_version);
- db.set_hard_fork_starting_height(original_version, 0);
}
else {
rescan_from_chain_height(height);
@@ -215,7 +215,6 @@ bool HardFork::reorganize_from_block_height(uint64_t height)
const uint64_t rescan_height = height >= (window_size - 1) ? height - (window_size -1) : 0;
const uint8_t start_version = height == 0 ? original_version : db.get_hard_fork_version(height);
while (current_fork_index > 0 && heights[current_fork_index].version > start_version) {
- db.set_hard_fork_starting_height(heights[current_fork_index].version, std::numeric_limits<uint64_t>::max());
--current_fork_index;
}
for (uint64_t h = rescan_height; h <= height; ++h) {
@@ -227,10 +226,6 @@ bool HardFork::reorganize_from_block_height(uint64_t height)
uint8_t voted = get_voted_fork_index(height + 1);
if (voted > current_fork_index) {
- for (int v = heights[current_fork_index].version + 1; v <= heights[voted].version; ++v) {
- // we reached the vote threshold with this block, next one will be forked
- db.set_hard_fork_starting_height(v, height + 1);
- }
current_fork_index = voted;
}
@@ -337,12 +332,6 @@ uint8_t HardFork::get(uint64_t height) const
return db.get_hard_fork_version(height);
}
-uint64_t HardFork::get_start_height(uint8_t version) const
-{
- CRITICAL_REGION_LOCAL(lock);
- return db.get_hard_fork_starting_height(version);
-}
-
uint8_t HardFork::get_current_version() const
{
CRITICAL_REGION_LOCAL(lock);
diff --git a/src/cryptonote_core/hardfork.h b/src/cryptonote_core/hardfork.h
index d9ef04113..b3d485878 100644
--- a/src/cryptonote_core/hardfork.h
+++ b/src/cryptonote_core/hardfork.h
@@ -155,13 +155,6 @@ namespace cryptonote
uint8_t get(uint64_t height) const;
/**
- * @brief returns the height of the first block on the fork with th given version
- *
- * @param version version of the fork to query the starting block for
- */
- uint64_t get_start_height(uint8_t version) const;
-
- /**
* @brief returns the latest "ideal" version
*
* This is the latest version that's been scheduled