mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
blockchain: guard against exceptions in add_new_block/children
Reporter requested credit to be given to Decred
This commit is contained in:
parent
5d850dde99
commit
90016ad744
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue