aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-09-24 10:10:28 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-09-24 10:10:28 -0500
commit06bee964a8989c3dcafdf8e665f74762814b43a2 (patch)
tree23a74b3f5dc698afbf95f79a9817cabed728b0b4 /src/blockchain_utilities
parentMerge pull request #5877 (diff)
parentRemoved Berkeley DB and db switching logic (diff)
downloadmonero-06bee964a8989c3dcafdf8e665f74762814b43a2.tar.xz
Merge pull request #5878
f9b3f6e Removed Berkeley DB and db switching logic (JesusRami)
Diffstat (limited to 'src/blockchain_utilities')
-rw-r--r--src/blockchain_utilities/blockchain_ancestry.cpp25
-rw-r--r--src/blockchain_utilities/blockchain_blackball.cpp16
-rw-r--r--src/blockchain_utilities/blockchain_depth.cpp25
-rw-r--r--src/blockchain_utilities/blockchain_export.cpp25
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp69
-rw-r--r--src/blockchain_utilities/blockchain_prune.cpp29
-rw-r--r--src/blockchain_utilities/blockchain_prune_known_spent_data.cpp24
-rw-r--r--src/blockchain_utilities/blockchain_stats.cpp24
-rw-r--r--src/blockchain_utilities/blockchain_usage.cpp25
9 files changed, 26 insertions, 236 deletions
diff --git a/src/blockchain_utilities/blockchain_ancestry.cpp b/src/blockchain_utilities/blockchain_ancestry.cpp
index a6ee0573f..db6d6f7d7 100644
--- a/src/blockchain_utilities/blockchain_ancestry.cpp
+++ b/src/blockchain_utilities/blockchain_ancestry.cpp
@@ -40,7 +40,6 @@
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -336,11 +335,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
tools::on_startup();
@@ -350,9 +344,6 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<std::string> arg_txid = {"txid", "Get ancestry for this txid", ""};
const command_line::arg_descriptor<std::string> arg_output = {"output", "Get ancestry for this output (amount/offset format)", ""};
const command_line::arg_descriptor<uint64_t> arg_height = {"height", "Get ancestry for all txes at this height", 0};
@@ -367,7 +358,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_txid);
command_line::add_arg(desc_cmd_sett, arg_output);
command_line::add_arg(desc_cmd_sett, arg_height);
@@ -446,13 +436,6 @@ int main(int argc, char* argv[])
}
}
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
// If we wanted to use the memory pool, we would set up a fake_core.
// Use Blockchain instead of lower-level BlockchainDB for two reasons:
@@ -468,13 +451,13 @@ int main(int argc, char* argv[])
std::unique_ptr<Blockchain> core_storage;
tx_memory_pool m_mempool(*core_storage);
core_storage.reset(new Blockchain(m_mempool));
- BlockchainDB *db = new_db(db_type);
+ BlockchainDB *db = new_db();
if (db == NULL)
{
- LOG_ERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ LOG_ERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- LOG_PRINT_L0("database: " << db_type);
+ LOG_PRINT_L0("database: LMDB");
const std::string filename = (boost::filesystem::path(opt_data_dir) / db->get_db_name()).string();
LOG_PRINT_L0("Loading blockchain from folder " << filename << " ...");
diff --git a/src/blockchain_utilities/blockchain_blackball.cpp b/src/blockchain_utilities/blockchain_blackball.cpp
index 857e97afd..4a5712921 100644
--- a/src/blockchain_utilities/blockchain_blackball.cpp
+++ b/src/blockchain_utilities/blockchain_blackball.cpp
@@ -39,7 +39,6 @@
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "wallet/ringdb.h"
#include "version.h"
@@ -1170,11 +1169,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
tools::on_startup();
@@ -1188,9 +1182,6 @@ int main(int argc, char* argv[])
get_default_db_path(),
};
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<bool> arg_rct_only = {"rct-only", "Only work on ringCT outputs", false};
const command_line::arg_descriptor<bool> arg_check_subsets = {"check-subsets", "Check ring subsets (very expensive)", false};
const command_line::arg_descriptor<bool> arg_verbose = {"verbose", "Verbose output)", false};
@@ -1207,7 +1198,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, arg_blackball_db_dir);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_rct_only);
command_line::add_arg(desc_cmd_sett, arg_check_subsets);
command_line::add_arg(desc_cmd_sett, arg_verbose);
@@ -1261,12 +1251,6 @@ int main(int argc, char* argv[])
std::string extra_spent_list = command_line::get_arg(vm, arg_extra_spent_list);
std::vector<std::pair<uint64_t, uint64_t>> extra_spent_outputs = extra_spent_list.empty() ? std::vector<std::pair<uint64_t, uint64_t>>() : load_outputs(extra_spent_list);
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
std::string db_sync_mode = command_line::get_arg(vm, arg_db_sync_mode);
if (!parse_db_sync_mode(db_sync_mode))
diff --git a/src/blockchain_utilities/blockchain_depth.cpp b/src/blockchain_utilities/blockchain_depth.cpp
index 8be83ee67..153f5f7c6 100644
--- a/src/blockchain_utilities/blockchain_depth.cpp
+++ b/src/blockchain_utilities/blockchain_depth.cpp
@@ -34,7 +34,6 @@
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -50,11 +49,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
tools::on_startup();
@@ -64,9 +58,6 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<std::string> arg_txid = {"txid", "Get min depth for this txid", ""};
const command_line::arg_descriptor<uint64_t> arg_height = {"height", "Get min depth for all txes at this height", 0};
const command_line::arg_descriptor<bool> arg_include_coinbase = {"include-coinbase", "Include coinbase in the average", false};
@@ -75,7 +66,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_txid);
command_line::add_arg(desc_cmd_sett, arg_height);
command_line::add_arg(desc_cmd_sett, arg_include_coinbase);
@@ -133,13 +123,6 @@ int main(int argc, char* argv[])
}
}
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
// If we wanted to use the memory pool, we would set up a fake_core.
// Use Blockchain instead of lower-level BlockchainDB for two reasons:
@@ -155,13 +138,13 @@ int main(int argc, char* argv[])
std::unique_ptr<Blockchain> core_storage;
tx_memory_pool m_mempool(*core_storage);
core_storage.reset(new Blockchain(m_mempool));
- BlockchainDB *db = new_db(db_type);
+ BlockchainDB *db = new_db();
if (db == NULL)
{
- LOG_ERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ LOG_ERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- LOG_PRINT_L0("database: " << db_type);
+ LOG_PRINT_L0("database: LMDB");
const std::string filename = (boost::filesystem::path(opt_data_dir) / db->get_db_name()).string();
LOG_PRINT_L0("Loading blockchain from folder " << filename << " ...");
diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp
index 85566efca..b180f88de 100644
--- a/src/blockchain_utilities/blockchain_export.cpp
+++ b/src/blockchain_utilities/blockchain_export.cpp
@@ -32,7 +32,6 @@
#include "cryptonote_core/tx_pool.h"
#include "cryptonote_core/cryptonote_core.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -47,11 +46,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
uint64_t block_stop = 0;
bool blocks_dat = false;
@@ -65,9 +59,6 @@ int main(int argc, char* argv[])
const command_line::arg_descriptor<std::string> arg_output_file = {"output-file", "Specify output file", "", true};
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
const command_line::arg_descriptor<uint64_t> arg_block_stop = {"block-stop", "Stop at block number", block_stop};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<bool> arg_blocks_dat = {"blocksdat", "Output in blocks.dat format", blocks_dat};
@@ -76,7 +67,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_block_stop);
command_line::add_arg(desc_cmd_sett, arg_blocks_dat);
@@ -124,13 +114,6 @@ int main(int argc, char* argv[])
m_config_folder = command_line::get_arg(vm, cryptonote::arg_data_dir);
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
if (command_line::has_arg(vm, arg_output_file))
output_file_path = boost::filesystem::path(command_line::get_arg(vm, arg_output_file));
else
@@ -153,13 +136,13 @@ int main(int argc, char* argv[])
tx_memory_pool m_mempool(*core_storage);
core_storage = new Blockchain(m_mempool);
- BlockchainDB* db = new_db(db_type);
+ BlockchainDB* db = new_db();
if (db == NULL)
{
- LOG_ERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ LOG_ERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- LOG_PRINT_L0("database: " << db_type);
+ LOG_PRINT_L0("database: LMDB");
boost::filesystem::path folder(m_config_folder);
folder /= db->get_db_name();
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index 801fe34ef..a285c2bd0 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -42,7 +42,6 @@
#include "serialization/binary_utils.h" // dump_binary(), parse_binary()
#include "serialization/json_utils.h" // dump_json()
#include "include_base_utils.h"
-#include "blockchain_db/db_types.h"
#include "cryptonote_core/cryptonote_core.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -93,44 +92,6 @@ int get_db_flags_from_mode(const std::string& db_mode)
return db_flags;
}
-int parse_db_arguments(const std::string& db_arg_str, std::string& db_type, int& db_flags)
-{
- std::vector<std::string> db_args;
- boost::split(db_args, db_arg_str, boost::is_any_of("#"));
- db_type = db_args.front();
- boost::algorithm::trim(db_type);
-
- if (db_args.size() == 1)
- {
- return 0;
- }
- else if (db_args.size() > 2)
- {
- std::cerr << "unrecognized database argument format: " << db_arg_str << ENDL;
- return 1;
- }
-
- std::string db_arg_str2 = db_args[1];
- boost::split(db_args, db_arg_str2, boost::is_any_of(","));
-
- // optionally use a composite mode instead of individual flags
- const std::unordered_set<std::string> db_modes {"safe", "fast", "fastest"};
- std::string db_mode;
- if (db_args.size() == 1)
- {
- if (db_modes.count(db_args[0]) > 0)
- {
- db_mode = db_args[0];
- }
- }
- if (! db_mode.empty())
- {
- db_flags = get_db_flags_from_mode(db_mode);
- }
- return 0;
-}
-
-
int pop_blocks(cryptonote::core& core, int num_blocks)
{
bool use_batch = opt_batch;
@@ -594,11 +555,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
uint64_t num_blocks = 0;
uint64_t block_stop = 0;
@@ -622,9 +578,6 @@ int main(int argc, char* argv[])
, "Count blocks in bootstrap file and exit"
, false
};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<bool> arg_noverify = {"dangerous-unverified-import",
"Blindly trust the import file and use potentially malicious blocks and transactions during import (only enable if you exported the file yourself)", false};
const command_line::arg_descriptor<bool> arg_batch = {"batch",
@@ -634,7 +587,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, arg_input_file);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_batch_size);
command_line::add_arg(desc_cmd_sett, arg_block_stop);
@@ -709,7 +661,6 @@ int main(int argc, char* argv[])
return 1;
}
m_config_folder = command_line::get_arg(vm, cryptonote::arg_data_dir);
- db_arg_str = command_line::get_arg(vm, arg_database);
mlog_configure(mlog_get_default_log_path("monero-blockchain-import.log"), true);
if (!command_line::is_arg_defaulted(vm, arg_log_level))
@@ -735,25 +686,7 @@ int main(int argc, char* argv[])
return 0;
}
-
- std::string db_type;
- int db_flags = 0;
- int res = 0;
- res = parse_db_arguments(db_arg_str, db_type, db_flags);
- if (res)
- {
- std::cerr << "Error parsing database argument(s)" << ENDL;
- return 1;
- }
-
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
- MINFO("database: " << db_type);
- MINFO("database flags: " << db_flags);
+ MINFO("database: LMDB");
MINFO("verify: " << std::boolalpha << opt_verify << std::noboolalpha);
if (opt_batch)
{
diff --git a/src/blockchain_utilities/blockchain_prune.cpp b/src/blockchain_utilities/blockchain_prune.cpp
index 8e13f2c04..9a9d58c46 100644
--- a/src/blockchain_utilities/blockchain_prune.cpp
+++ b/src/blockchain_utilities/blockchain_prune.cpp
@@ -35,7 +35,6 @@
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
#include "blockchain_db/lmdb/db_lmdb.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -441,11 +440,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
tools::on_startup();
@@ -455,9 +449,6 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.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]:[nrecords_per_sync]."
@@ -469,7 +460,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_db_sync_mode);
command_line::add_arg(desc_cmd_sett, arg_copy_pruned_database);
command_line::add_arg(desc_cmd_only, command_line::arg_help);
@@ -511,18 +501,6 @@ int main(int argc, char* argv[])
while (boost::ends_with(data_dir, "/") || boost::ends_with(data_dir, "\\"))
data_dir.pop_back();
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- MERROR("Invalid database type: " << db_type);
- return 1;
- }
- if (db_type != "lmdb")
- {
- MERROR("Unsupported database type: " << db_type << ". Only lmdb is supported");
- return 1;
- }
-
std::string db_sync_mode = command_line::get_arg(vm, arg_db_sync_mode);
uint64_t db_flags = 0;
if (!parse_db_sync_mode(db_sync_mode, db_flags))
@@ -552,13 +530,12 @@ int main(int argc, char* argv[])
{
core_storage[n].reset(new Blockchain(m_mempool));
- BlockchainDB* db = new_db(db_type);
+ BlockchainDB* db = new_db();
if (db == NULL)
{
- MERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ MERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- MDEBUG("database: " << db_type);
if (n == 1)
{
diff --git a/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp b/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp
index 2d49b6ecd..cee24d4da 100644
--- a/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp
+++ b/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp
@@ -33,7 +33,6 @@
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -102,11 +101,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
tools::on_startup();
@@ -114,9 +108,6 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<bool> arg_verbose = {"verbose", "Verbose output", false};
const command_line::arg_descriptor<bool> arg_dry_run = {"dry-run", "Do not actually prune", false};
const command_line::arg_descriptor<std::string> arg_input = {"input", "Path to the known spent outputs file"};
@@ -125,7 +116,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_verbose);
command_line::add_arg(desc_cmd_sett, arg_dry_run);
command_line::add_arg(desc_cmd_sett, arg_input);
@@ -167,26 +157,18 @@ int main(int argc, char* argv[])
bool opt_verbose = command_line::get_arg(vm, arg_verbose);
bool opt_dry_run = command_line::get_arg(vm, arg_dry_run);
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
const std::string input = command_line::get_arg(vm, arg_input);
LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
std::unique_ptr<Blockchain> core_storage;
tx_memory_pool m_mempool(*core_storage);
core_storage.reset(new Blockchain(m_mempool));
- BlockchainDB *db = new_db(db_type);
+ BlockchainDB *db = new_db();
if (db == NULL)
{
- LOG_ERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ LOG_ERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- LOG_PRINT_L0("database: " << db_type);
const std::string filename = (boost::filesystem::path(opt_data_dir) / db->get_db_name()).string();
LOG_PRINT_L0("Loading blockchain from folder " << filename << " ...");
diff --git a/src/blockchain_utilities/blockchain_stats.cpp b/src/blockchain_utilities/blockchain_stats.cpp
index 33c26277e..2f66d54aa 100644
--- a/src/blockchain_utilities/blockchain_stats.cpp
+++ b/src/blockchain_utilities/blockchain_stats.cpp
@@ -34,7 +34,6 @@
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -52,11 +51,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
uint64_t block_start = 0;
uint64_t block_stop = 0;
@@ -68,9 +62,6 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<uint64_t> arg_block_start = {"block-start", "start at block number", block_start};
const command_line::arg_descriptor<uint64_t> arg_block_stop = {"block-stop", "Stop at block number", block_stop};
const command_line::arg_descriptor<bool> arg_inputs = {"with-inputs", "with input stats", false};
@@ -82,7 +73,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_block_start);
command_line::add_arg(desc_cmd_sett, arg_block_stop);
command_line::add_arg(desc_cmd_sett, arg_inputs);
@@ -131,24 +121,16 @@ int main(int argc, char* argv[])
bool do_ringsize = command_line::get_arg(vm, arg_ringsize);
bool do_hours = command_line::get_arg(vm, arg_hours);
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
std::unique_ptr<Blockchain> core_storage;
tx_memory_pool m_mempool(*core_storage);
core_storage.reset(new Blockchain(m_mempool));
- BlockchainDB *db = new_db(db_type);
+ BlockchainDB *db = new_db();
if (db == NULL)
{
- LOG_ERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ LOG_ERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- LOG_PRINT_L0("database: " << db_type);
const std::string filename = (boost::filesystem::path(opt_data_dir) / db->get_db_name()).string();
LOG_PRINT_L0("Loading blockchain from folder " << filename << " ...");
diff --git a/src/blockchain_utilities/blockchain_usage.cpp b/src/blockchain_utilities/blockchain_usage.cpp
index bd73350b3..2fa56452b 100644
--- a/src/blockchain_utilities/blockchain_usage.cpp
+++ b/src/blockchain_utilities/blockchain_usage.cpp
@@ -34,7 +34,6 @@
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/db_types.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -82,11 +81,6 @@ int main(int argc, char* argv[])
epee::string_tools::set_module_name_and_folder(argv[0]);
- std::string default_db_type = "lmdb";
-
- std::string available_dbs = cryptonote::blockchain_db_types(", ");
- available_dbs = "available: " + available_dbs;
-
uint32_t log_level = 0;
tools::on_startup();
@@ -96,16 +90,12 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
- const command_line::arg_descriptor<std::string> arg_database = {
- "database", available_dbs.c_str(), default_db_type
- };
const command_line::arg_descriptor<bool> arg_rct_only = {"rct-only", "Only work on ringCT outputs", false};
const command_line::arg_descriptor<std::string> arg_input = {"input", ""};
command_line::add_arg(desc_cmd_sett, cryptonote::arg_testnet_on);
command_line::add_arg(desc_cmd_sett, cryptonote::arg_stagenet_on);
command_line::add_arg(desc_cmd_sett, arg_log_level);
- command_line::add_arg(desc_cmd_sett, arg_database);
command_line::add_arg(desc_cmd_sett, arg_rct_only);
command_line::add_arg(desc_cmd_sett, arg_input);
command_line::add_arg(desc_cmd_only, command_line::arg_help);
@@ -147,13 +137,6 @@ int main(int argc, char* argv[])
network_type net_type = opt_testnet ? TESTNET : opt_stagenet ? STAGENET : MAINNET;
bool opt_rct_only = command_line::get_arg(vm, arg_rct_only);
- std::string db_type = command_line::get_arg(vm, arg_database);
- if (!cryptonote::blockchain_valid_db_type(db_type))
- {
- std::cerr << "Invalid database type: " << db_type << std::endl;
- return 1;
- }
-
// If we wanted to use the memory pool, we would set up a fake_core.
// Use Blockchain instead of lower-level BlockchainDB for two reasons:
@@ -170,13 +153,13 @@ int main(int argc, char* argv[])
std::unique_ptr<Blockchain> core_storage;
tx_memory_pool m_mempool(*core_storage);
core_storage.reset(new Blockchain(m_mempool));
- BlockchainDB* db = new_db(db_type);
+ BlockchainDB* db = new_db();
if (db == NULL)
{
- LOG_ERROR("Attempted to use non-existent database type: " << db_type);
- throw std::runtime_error("Attempting to use non-existent database type");
+ LOG_ERROR("Failed to initialize a database");
+ throw std::runtime_error("Failed to initialize a database");
}
- LOG_PRINT_L0("database: " << db_type);
+ LOG_PRINT_L0("database: LMDB");
const std::string filename = input;
LOG_PRINT_L0("Loading blockchain from folder " << filename << " ...");