aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/lmdb
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2016-01-15 14:00:58 +0000
committerHoward Chu <hyc@symas.com>2016-01-15 17:26:19 +0000
commit30f92f5630bbc7507708275a29a9ae7acf633a5b (patch)
tree56cd61f113b9bed7eeef4b84729cb4cab356fc80 /src/blockchain_db/lmdb
parentMerge pull request #612 (diff)
downloadmonero-30f92f5630bbc7507708275a29a9ae7acf633a5b.tar.xz
Fix hf when import with verify off
Delete the hf tables, so the next open will rescan and regenerate
Diffstat (limited to 'src/blockchain_db/lmdb')
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp21
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 7bf5d304b..17a0f9ec2 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -2434,6 +2434,27 @@ void BlockchainLMDB::get_output_tx_and_index(const uint64_t& amount, const std::
LOG_PRINT_L3("db3: " << db3);
}
+void BlockchainLMDB::check_hard_fork_info()
+{
+ LOG_PRINT_L3("BlockchainLMDB::" << __func__);
+ check_open();
+
+ TXN_PREFIX(0);
+
+ MDB_stat db_stat1, db_stat2;
+ if (mdb_stat(*txn_ptr, m_blocks, &db_stat1))
+ throw0(DB_ERROR("Failed to query m_blocks"));
+ if (mdb_stat(*txn_ptr, m_hf_versions, &db_stat2))
+ throw0(DB_ERROR("Failed to query m_hf_starting_heights"));
+ if (db_stat1.ms_entries != db_stat2.ms_entries)
+ {
+ mdb_drop(*txn_ptr, m_hf_starting_heights, 1);
+ mdb_drop(*txn_ptr, m_hf_versions, 1);
+ }
+
+ TXN_POSTFIX_SUCCESS();
+}
+
void BlockchainLMDB::set_hard_fork_starting_height(uint8_t version, uint64_t height)
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h
index 3a6f8bbd8..48f4adb41 100644
--- a/src/blockchain_db/lmdb/db_lmdb.h
+++ b/src/blockchain_db/lmdb/db_lmdb.h
@@ -235,6 +235,7 @@ private:
virtual uint64_t get_hard_fork_starting_height(uint8_t version) const;
virtual void set_hard_fork_version(uint64_t height, uint8_t version);
virtual uint8_t get_hard_fork_version(uint64_t height) const;
+ virtual void check_hard_fork_info();
/**
* @brief convert a tx output to a blob for storage