Note: instantiating a CDBWrapper
can throw other errors such as a fs::filesystem_error
from here, but I suppose that is not something the user can recover from with a reindex so not catching that here seems correct.
I think it logging the dbwrapper_error
would be useful though?
0diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp
1index 76094105fa..b9c3981910 100644
2--- a/src/node/chainstate.cpp
3+++ b/src/node/chainstate.cpp
4@@ -48,8 +48,10 @@ static ChainstateLoadResult CompleteChainstateInitialization(
5 .memory_only = options.block_tree_db_in_memory,
6 .wipe_data = options.wipe_block_tree_db,
7 .options = chainman.m_options.block_tree_db});
8- } catch (dbwrapper_error&) {
9- return {ChainstateLoadStatus::FAILURE, _("Error opening block database")};
10+ } catch (dbwrapper_error& err) {
11+ auto msg{_("Error opening block database")};
12+ LogError("%s: %s\n", msg.original, err.what());
13+ return {ChainstateLoadStatus::FAILURE, msg};
14 }
15
16 if (options.wipe_block_tree_db) {
17@@ -116,8 +118,10 @@ static ChainstateLoadResult CompleteChainstateInitialization(
18 /*cache_size_bytes=*/chainman.m_total_coinsdb_cache * init_cache_fraction,
19 /*in_memory=*/options.coins_db_in_memory,
20 /*should_wipe=*/options.wipe_chainstate_db);
21- } catch (dbwrapper_error&) {
22- return {ChainstateLoadStatus::FAILURE, _("Error opening coins database")};
23+ } catch (dbwrapper_error& err) {
24+ auto msg{_("Error opening coins database")};
25+ LogError("%s: %s\n", msg.original, err.what());
26+ return {ChainstateLoadStatus::FAILURE, msg};
27 }
28
29 if (options.coins_error_cb) {