mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 16:02:24 +00:00
core: guard against exceptions in handle_incoming_{block,tx}
When one happens, cleanup must be called or the incoming tx lock will stay locked
This commit is contained in:
parent
72b5f37f58
commit
84fa015e77
1 changed files with 8 additions and 0 deletions
|
@ -585,6 +585,8 @@ namespace cryptonote
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::handle_incoming_txs(const std::list<blobdata>& tx_blobs, std::vector<tx_verification_context>& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
bool core::handle_incoming_txs(const std::list<blobdata>& tx_blobs, std::vector<tx_verification_context>& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
|
|
||||||
struct result { bool res; cryptonote::transaction tx; crypto::hash hash; crypto::hash prefix_hash; bool in_txpool; bool in_blockchain; };
|
struct result { bool res; cryptonote::transaction tx; crypto::hash hash; crypto::hash prefix_hash; bool in_txpool; bool in_blockchain; };
|
||||||
std::vector<result> results(tx_blobs.size());
|
std::vector<result> results(tx_blobs.size());
|
||||||
|
|
||||||
|
@ -638,6 +640,8 @@ namespace cryptonote
|
||||||
MDEBUG("tx added: " << results[i].hash);
|
MDEBUG("tx added: " << results[i].hash);
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
|
||||||
|
CATCH_ENTRY_L0("core::handle_incoming_txs()", false);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
bool core::handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||||
|
@ -1075,6 +1079,8 @@ namespace cryptonote
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate)
|
bool core::handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate)
|
||||||
{
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
|
|
||||||
// load json & DNS checkpoints every 10min/hour respectively,
|
// load json & DNS checkpoints every 10min/hour respectively,
|
||||||
// and verify them with respect to what blocks we already have
|
// and verify them with respect to what blocks we already have
|
||||||
CHECK_AND_ASSERT_MES(update_checkpoints(), false, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints.");
|
CHECK_AND_ASSERT_MES(update_checkpoints(), false, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints.");
|
||||||
|
@ -1098,6 +1104,8 @@ namespace cryptonote
|
||||||
if(update_miner_blocktemplate && bvc.m_added_to_main_chain)
|
if(update_miner_blocktemplate && bvc.m_added_to_main_chain)
|
||||||
update_miner_block_template();
|
update_miner_block_template();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
CATCH_ENTRY_L0("core::handle_incoming_block()", false);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
// Used by the RPC server to check the size of an incoming
|
// Used by the RPC server to check the size of an incoming
|
||||||
|
|
Loading…
Reference in a new issue