aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwarptangent <warptangent@tutanota.com>2016-02-04 20:09:51 -0800
committerwarptangent <warptangent@tutanota.com>2016-02-08 08:50:48 -0800
commitf7e337e6254c1c4115a8430964a6f6b54305b3ae (patch)
treef0a0d062d0d3ff6912e90622e12309fbee2b2be9 /src
parentblockchain_import: Add --drop-hard-fork command (diff)
downloadmonero-f7e337e6254c1c4115a8430964a6f6b54305b3ae.tar.xz
fake_core: Check if hard fork subdbs need reset at start
Diffstat (limited to 'src')
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp10
-rw-r--r--src/blockchain_utilities/fake_core.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 541e838f7..5982b9d9a 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -2450,8 +2450,14 @@ void BlockchainLMDB::check_hard_fork_info()
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);
+ // Empty, but don't delete. This allows this function to be called after
+ // startup, after the subdbs have already been created, and rest of startup
+ // can proceed. If these don't exist, hard fork's init() will fail.
+ //
+ // If these are empty, hard fork's init() will repopulate the hard fork
+ // data.
+ mdb_drop(*txn_ptr, m_hf_starting_heights, 0);
+ mdb_drop(*txn_ptr, m_hf_versions, 0);
}
TXN_POSTFIX_SUCCESS();
diff --git a/src/blockchain_utilities/fake_core.h b/src/blockchain_utilities/fake_core.h
index 245d535fc..4b8c28902 100644
--- a/src/blockchain_utilities/fake_core.h
+++ b/src/blockchain_utilities/fake_core.h
@@ -75,7 +75,10 @@ struct fake_core_lmdb
throw;
}
+ db->check_hard_fork_info();
+
m_storage.init(db, use_testnet);
+
if (do_batch)
m_storage.get_db().set_batch_transactions(do_batch);
support_batch = true;