diff options
author | Thomas Winget <tewinget@gmail.com> | 2015-01-09 07:29:05 -0500 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2015-01-09 07:29:05 -0500 |
commit | 429a7405622ef84c17ecc851d0a6ac0086218837 (patch) | |
tree | 2ef24ee9f96ba5c33cc74e24b8e224378b686a50 /src | |
parent | Fixes segfault in Blockchain::handle_alternative_block (diff) | |
download | monero-429a7405622ef84c17ecc851d0a6ac0086218837.tar.xz |
throw inline functions need to keep exception type
As it is useful for functions calling BlockchainDB functions to know
whether an exception is expected (attempting to get a block that doesn't
exist and counting it missing if not, to save time checking if it
does, for example), the inline functions throw{0,1} need to keep the
exception type information.
Slight comment update due to copy/paste failure.
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp index 5b71dcf08..0184dbc58 100644 --- a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp +++ b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp @@ -39,13 +39,15 @@ using epee::string_tools::pod_to_hex; namespace { -inline void throw0(const std::exception &e) +template <typename T> +inline void throw0(const T &e) { LOG_PRINT_L0(e.what()); throw e; } -inline void throw1(const std::exception &e) +template <typename T> +inline void throw1(const T &e) { LOG_PRINT_L1(e.what()); throw e; @@ -814,7 +816,7 @@ difficulty_type BlockchainLMDB::get_block_cumulative_difficulty(const uint64_t& auto get_result = mdb_get(txn, m_block_diffs, &key, &result); if (get_result == MDB_NOTFOUND) { - throw0(DB_ERROR(std::string("Attempt to get cumulative difficulty from height ").append(boost::lexical_cast<std::string>(height)).append(" failed -- block size not in db").c_str())); + throw0(DB_ERROR(std::string("Attempt to get cumulative difficulty from height ").append(boost::lexical_cast<std::string>(height)).append(" failed -- difficulty not in db").c_str())); } else if (get_result) throw0(DB_ERROR("Error attempting to retrieve a cumulative difficulty from the db")); |