aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-07-06 15:47:57 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-07-30 22:52:11 +0000
commit90016ad744285941435b1c4e070a3037d93d0d07 (patch)
tree9b0e14f4a4a5a52d22d131612354c8ec92e9f74c
parentMerge pull request #6586 (diff)
downloadmonero-90016ad744285941435b1c4e070a3037d93d0d07.tar.xz
blockchain: guard against exceptions in add_new_block/children
Reporter requested credit to be given to Decred
-rw-r--r--src/cryptonote_core/blockchain.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 7851b0f6a..21cbb48e9 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -4369,6 +4369,9 @@ bool Blockchain::update_next_cumulative_weight_limit(uint64_t *long_term_effecti
//------------------------------------------------------------------
bool Blockchain::add_new_block(const block& bl, block_verification_context& bvc)
{
+ try
+ {
+
LOG_PRINT_L3("Blockchain::" << __func__);
crypto::hash id = get_block_hash(bl);
CRITICAL_REGION_LOCAL(m_tx_pool);//to avoid deadlock lets lock tx_pool for whole add/reorganize process
@@ -4396,6 +4399,14 @@ bool Blockchain::add_new_block(const block& bl, block_verification_context& bvc)
rtxn_guard.stop();
return handle_block_to_main_chain(bl, id, bvc);
+
+ }
+ catch (const std::exception &e)
+ {
+ LOG_ERROR("Exception at [add_new_block], what=" << e.what());
+ bvc.m_verifivation_failed = true;
+ return false;
+ }
}
//------------------------------------------------------------------
//TODO: Refactor, consider returning a failure height and letting