aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/lmdb
diff options
context:
space:
mode:
authorwarptangent <warptangent@tutanota.com>2015-12-26 14:27:35 -0800
committerwarptangent <warptangent@tutanota.com>2015-12-26 14:30:20 -0800
commitee9d71e9f94ba8571c44c889a70bda77c8961959 (patch)
treec5636f8390be8d8a51d81e7c05dbe8f82ba1440b /src/blockchain_db/lmdb
parentMerge pull request #565 (diff)
downloadmonero-ee9d71e9f94ba8571c44c889a70bda77c8961959.tar.xz
BlockchainDB: skip fixup check if read-only database
Diffstat (limited to 'src/blockchain_db/lmdb')
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp14
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 325ed8b8c..d625e5a07 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -2496,8 +2496,22 @@ uint8_t BlockchainLMDB::get_hard_fork_version(uint64_t height) const
return ret;
}
+bool BlockchainLMDB::is_read_only() const
+{
+ unsigned int flags;
+ auto result = mdb_env_get_flags(m_env, &flags);
+ if (result)
+ throw0(DB_ERROR(std::string("Error getting database environment info: ").append(mdb_strerror(result)).c_str()));
+
+ if (flags & MDB_RDONLY)
+ return true;
+
+ return false;
+}
+
void BlockchainLMDB::fixup()
{
+ LOG_PRINT_L3("BlockchainLMDB::" << __func__);
// Always call parent as well
BlockchainDB::fixup();
}
diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h
index d1d3b942d..7332d64c6 100644
--- a/src/blockchain_db/lmdb/db_lmdb.h
+++ b/src/blockchain_db/lmdb/db_lmdb.h
@@ -266,6 +266,8 @@ private:
void check_open() const;
+ virtual bool is_read_only() const;
+
// fix up anything that may be wrong due to past bugs
virtual void fixup();