aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-15 20:57:26 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-15 20:57:26 +0200
commit3ff67323b73ef193c56a025d4a682554adb40dea (patch)
tree1e8bee3096c02f037d3e7bcc4dfb6835432937d4 /src/cryptonote_core
parentMerge pull request #2293 (diff)
parentcore: add --db-salvage command line flag (diff)
downloadmonero-3ff67323b73ef193c56a025d4a682554adb40dea.tar.xz
Merge pull request #2288
c6e200a8 core: add --db-salvage command line flag (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 62c536ab8..ac2d3023a 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -164,6 +164,7 @@ namespace cryptonote
command_line::add_arg(desc, command_line::arg_prep_blocks_threads);
command_line::add_arg(desc, command_line::arg_fast_block_sync);
command_line::add_arg(desc, command_line::arg_db_sync_mode);
+ command_line::add_arg(desc, command_line::arg_db_salvage);
command_line::add_arg(desc, command_line::arg_show_time_stats);
command_line::add_arg(desc, command_line::arg_block_sync_size);
command_line::add_arg(desc, command_line::arg_check_updates);
@@ -278,6 +279,7 @@ namespace cryptonote
std::string db_type = command_line::get_arg(vm, command_line::arg_db_type);
std::string db_sync_mode = command_line::get_arg(vm, command_line::arg_db_sync_mode);
+ bool db_salvage = command_line::get_arg(vm, command_line::arg_db_salvage) != 0;
bool fast_sync = command_line::get_arg(vm, command_line::arg_fast_block_sync) != 0;
uint64_t blocks_threads = command_line::get_arg(vm, command_line::arg_prep_blocks_threads);
std::string check_updates_string = command_line::get_arg(vm, command_line::arg_check_updates);
@@ -310,12 +312,14 @@ namespace cryptonote
uint64_t DBS_FAST_MODE = 0;
uint64_t DBS_FASTEST_MODE = 0;
uint64_t DBS_SAFE_MODE = 0;
+ uint64_t DBS_SALVAGE = 0;
if (db_type == "lmdb")
{
db = new BlockchainLMDB();
DBS_SAFE_MODE = MDB_NORDAHEAD;
DBS_FAST_MODE = MDB_NORDAHEAD | MDB_NOSYNC;
DBS_FASTEST_MODE = MDB_NORDAHEAD | MDB_NOSYNC | MDB_WRITEMAP | MDB_MAPASYNC;
+ DBS_SALVAGE = MDB_PREVSNAPSHOT;
}
else
{
@@ -387,6 +391,9 @@ namespace cryptonote
blocks_per_sync = bps;
}
+ if (db_salvage)
+ db_flags |= DBS_SALVAGE;
+
db->open(filename, db_flags);
if(!db->m_open)
return false;