diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-08-16 12:55:24 -0700 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-08-16 12:55:25 -0700 |
commit | d73b1b6560a51a052b796f4dcd4e6778ef285d1f (patch) | |
tree | 01116d96637d76a8bf562c786b96a63642d63ec7 /src/cryptonote_core | |
parent | Merge pull request #6722 (diff) | |
parent | rpc: reject wrong sized txid (diff) | |
download | monero-d73b1b6560a51a052b796f4dcd4e6778ef285d1f.tar.xz |
Merge pull request #6727
13eee1d6a rpc: reject wrong sized txid (moneromooo-monero)
92e6b7df2 easylogging++: fix crash with reentrant logging (moneromooo-monero)
6dd95d530 epee: guard against exceptions in RPC handlers (moneromooo-monero)
90016ad74 blockchain: guard against exceptions in add_new_block/children (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index ea2cd6aeb..882ee4894 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -4371,6 +4371,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 @@ -4398,6 +4401,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 |