aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-29 11:14:42 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-29 11:43:34 +0100
commita95e460c7116589b5dedf5c966cb84893fe8d521 (patch)
tree72aeafc3e811aed09ff513194fd745e44f7b6e9a /src/blockchain_db/blockchain_db.cpp
parentMerge pull request #2349 (diff)
downloadmonero-a95e460c7116589b5dedf5c966cb84893fe8d521.tar.xz
move db specific options to BlockchainDB
Avoids common depending on blockchain_db, which can cause link errors.
Diffstat (limited to 'src/blockchain_db/blockchain_db.cpp')
-rw-r--r--src/blockchain_db/blockchain_db.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index 01a59e079..d62a250ff 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -78,6 +78,23 @@ std::string blockchain_db_types(const std::string& sep)
return ret;
}
+std::string arg_db_type_description = "Specify database type, available: " + cryptonote::blockchain_db_types(", ");
+const command_line::arg_descriptor<std::string> arg_db_type = {
+ "db-type"
+, arg_db_type_description.c_str()
+, DEFAULT_DB_TYPE
+};
+const command_line::arg_descriptor<std::string> arg_db_sync_mode = {
+ "db-sync-mode"
+, "Specify sync option, using format [safe|fast|fastest]:[sync|async]:[nblocks_per_sync]."
+, "fast:async:1000"
+};
+const command_line::arg_descriptor<bool> arg_db_salvage = {
+ "db-salvage"
+, "Try to salvage a blockchain database if it seems corrupted"
+, false
+};
+
BlockchainDB *new_db(const std::string& db_type)
{
if (db_type == "lmdb")
@@ -89,6 +106,13 @@ BlockchainDB *new_db(const std::string& db_type)
return NULL;
}
+void BlockchainDB::init_options(boost::program_options::options_description& desc)
+{
+ command_line::add_arg(desc, arg_db_type);
+ command_line::add_arg(desc, arg_db_sync_mode);
+ command_line::add_arg(desc, arg_db_salvage);
+}
+
void BlockchainDB::pop_block()
{
block blk;