Merge pull request #2438

9443eec1 core: guard against exceptions in tx verification worker threads (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-09-14 18:31:46 +02:00
commit 7abdba0a5c
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 18 additions and 2 deletions

View File

@ -595,7 +595,15 @@ namespace cryptonote
std::list<blobdata>::const_iterator it = tx_blobs.begin(); std::list<blobdata>::const_iterator it = tx_blobs.begin();
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) { for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
region.run([&, i, it] { region.run([&, i, it] {
try
{
results[i].res = handle_incoming_tx_pre(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay); results[i].res = handle_incoming_tx_pre(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay);
}
catch (const std::exception &e)
{
MERROR_VER("Exception in handle_incoming_tx_pre: " << e.what());
results[i].res = false;
}
}); });
} }
}); });
@ -615,7 +623,15 @@ namespace cryptonote
else else
{ {
region.run([&, i, it] { region.run([&, i, it] {
try
{
results[i].res = handle_incoming_tx_post(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay); results[i].res = handle_incoming_tx_post(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay);
}
catch (const std::exception &e)
{
MERROR_VER("Exception in handle_incoming_tx_post: " << e.what());
results[i].res = false;
}
}); });
} }
} }