mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 03:03:17 +00:00
Nicer looking exit when blockchain.bin is found
Do not print the exception message, and write the important bit in red, since people will only read the last line otherwise.
This commit is contained in:
parent
ac7d27d4f9
commit
1e07110a7a
3 changed files with 25 additions and 31 deletions
|
@ -231,6 +231,26 @@ namespace cryptonote
|
||||||
bool fast_sync = command_line::get_arg(vm, command_line::arg_fast_block_sync) != 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);
|
uint64_t blocks_threads = command_line::get_arg(vm, command_line::arg_prep_blocks_threads);
|
||||||
|
|
||||||
|
boost::filesystem::path folder(m_config_folder);
|
||||||
|
if (m_fakechain)
|
||||||
|
folder /= "fake";
|
||||||
|
//
|
||||||
|
// check for blockchain.bin
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const boost::filesystem::path old_files = folder;
|
||||||
|
if (boost::filesystem::exists(old_files / "blockchain.bin"))
|
||||||
|
{
|
||||||
|
LOG_PRINT_RED_L0("Found old-style blockchain.bin in " << old_files.string());
|
||||||
|
LOG_PRINT_RED_L0("Monero now uses a new format. You can either remove blockchain.bin to start syncing");
|
||||||
|
LOG_PRINT_RED_L0("the blockchain anew, or use blockchain_export and blockchain_import to convert your");
|
||||||
|
LOG_PRINT_RED_L0("existing blockchain.bin to the new format. See README.md for instructions.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// folder might not be a directory, etc, etc
|
||||||
|
catch (...) { }
|
||||||
|
|
||||||
BlockchainDB* db = nullptr;
|
BlockchainDB* db = nullptr;
|
||||||
uint64_t BDB_FAST_MODE = 0;
|
uint64_t BDB_FAST_MODE = 0;
|
||||||
uint64_t BDB_FASTEST_MODE = 0;
|
uint64_t BDB_FASTEST_MODE = 0;
|
||||||
|
@ -257,37 +277,9 @@ namespace cryptonote
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path folder(m_config_folder);
|
|
||||||
|
|
||||||
if (m_fakechain)
|
|
||||||
folder /= "fake";
|
|
||||||
|
|
||||||
folder /= db->get_db_name();
|
folder /= db->get_db_name();
|
||||||
|
|
||||||
LOG_PRINT_L0("Loading blockchain from folder " << folder.string() << " ...");
|
LOG_PRINT_L0("Loading blockchain from folder " << folder.string() << " ...");
|
||||||
|
|
||||||
// check for blockchain.bin
|
|
||||||
bool old_blockchain_found = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
const boost::filesystem::path old_files = folder.parent_path();
|
|
||||||
if (boost::filesystem::exists(folder.parent_path() / "blockchain.bin"))
|
|
||||||
{
|
|
||||||
LOG_PRINT_L0("Found old-style blockchain.bin in " << old_files.string());
|
|
||||||
LOG_PRINT_L0("Monero now uses a new format. You can either remove blockchain.bin to start syncing");
|
|
||||||
LOG_PRINT_L0("the blockchain anew, or use blockchain_export and blockchain_import to convert your");
|
|
||||||
LOG_PRINT_L0("existing blockchain.bin to the new format. See README.md for instructions.");
|
|
||||||
old_blockchain_found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// folder might not be a directory, etc, etc
|
|
||||||
catch (...) {}
|
|
||||||
|
|
||||||
if (old_blockchain_found)
|
|
||||||
{
|
|
||||||
throw DB_ERROR("Database could not be opened");
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string filename = folder.string();
|
const std::string filename = folder.string();
|
||||||
// temporarily default to fastest:async:1000
|
// temporarily default to fastest:async:1000
|
||||||
blockchain_db_sync_mode sync_mode = db_async;
|
blockchain_db_sync_mode sync_mode = db_async;
|
||||||
|
|
|
@ -66,15 +66,16 @@ public:
|
||||||
m_core.set_cryptonote_protocol(&protocol);
|
m_core.set_cryptonote_protocol(&protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
void run()
|
bool run()
|
||||||
{
|
{
|
||||||
//initialize core here
|
//initialize core here
|
||||||
LOG_PRINT_L0("Initializing core...");
|
LOG_PRINT_L0("Initializing core...");
|
||||||
if (!m_core.init(m_vm_HACK))
|
if (!m_core.init(m_vm_HACK))
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to initialize core");
|
return false;
|
||||||
}
|
}
|
||||||
LOG_PRINT_L0("Core initialized OK");
|
LOG_PRINT_L0("Core initialized OK");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cryptonote::core & get()
|
cryptonote::core & get()
|
||||||
|
|
|
@ -118,7 +118,8 @@ bool t_daemon::run(bool interactive)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mp_internals->core.run();
|
if (!mp_internals->core.run())
|
||||||
|
return false;
|
||||||
mp_internals->rpc.run();
|
mp_internals->rpc.run();
|
||||||
|
|
||||||
daemonize::t_command_server* rpc_commands;
|
daemonize::t_command_server* rpc_commands;
|
||||||
|
|
Loading…
Reference in a new issue