aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-09-02 11:34:25 +0200
committerRiccardo Spagni <ric@spagni.net>2017-09-02 11:34:25 +0200
commit7369d746fdb5639afc04c864202c16f932b5d5d3 (patch)
tree4fd1e393bf884308b8644b3afbadf109aa947236 /src/cryptonote_protocol
parentMerge pull request #2365 (diff)
parentcryptonote_protocol: error handling on cleanup_handle_incoming_blocks (diff)
downloadmonero-7369d746fdb5639afc04c864202c16f932b5d5d3.tar.xz
Merge pull request #2373
a3662bae cryptonote_protocol: error handling on cleanup_handle_incoming_blocks (moneromooo-monero) cf4aa653 Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks (moneromooo-monero) 0ffad5a3 core: guard against exceptions in handle_incoming_{block,tx} (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 4fe1f1fc1..7d95f134b 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -364,7 +364,12 @@ namespace cryptonote
block_verification_context bvc = boost::value_initialized<block_verification_context>();
m_core.handle_incoming_block(arg.b.block, bvc); // got block from handle_notify_new_block
- m_core.cleanup_handle_incoming_blocks(true);
+ if (!m_core.cleanup_handle_incoming_blocks(true))
+ {
+ LOG_PRINT_CCONTEXT_L0("Failure in cleanup_handle_incoming_blocks");
+ m_core.resume_mine();
+ return 1;
+ }
m_core.resume_mine();
if(bvc.m_verifivation_failed)
{
@@ -623,7 +628,12 @@ namespace cryptonote
block_verification_context bvc = boost::value_initialized<block_verification_context>();
m_core.handle_incoming_block(arg.b.block, bvc); // got block from handle_notify_new_block
- m_core.cleanup_handle_incoming_blocks(true);
+ if (!m_core.cleanup_handle_incoming_blocks(true))
+ {
+ LOG_PRINT_CCONTEXT_L0("Failure in cleanup_handle_incoming_blocks");
+ m_core.resume_mine();
+ return 1;
+ }
m_core.resume_mine();
if( bvc.m_verifivation_failed )
@@ -1056,7 +1066,11 @@ skip:
}))
LOG_ERROR_CCONTEXT("span connection id not found");
- m_core.cleanup_handle_incoming_blocks();
+ if (!m_core.cleanup_handle_incoming_blocks())
+ {
+ LOG_PRINT_CCONTEXT_L0("Failure in cleanup_handle_incoming_blocks");
+ return 1;
+ }
// in case the peer had dropped beforehand, remove the span anyway so other threads can wake up and get it
m_block_queue.remove_spans(span_connection_id, start_height);
return 1;
@@ -1081,7 +1095,12 @@ skip:
}))
LOG_ERROR_CCONTEXT("span connection id not found");
- m_core.cleanup_handle_incoming_blocks();
+ if (!m_core.cleanup_handle_incoming_blocks())
+ {
+ LOG_PRINT_CCONTEXT_L0("Failure in cleanup_handle_incoming_blocks");
+ return 1;
+ }
+
// in case the peer had dropped beforehand, remove the span anyway so other threads can wake up and get it
m_block_queue.remove_spans(span_connection_id, start_height);
return 1;
@@ -1095,7 +1114,12 @@ skip:
}))
LOG_ERROR_CCONTEXT("span connection id not found");
- m_core.cleanup_handle_incoming_blocks();
+ if (!m_core.cleanup_handle_incoming_blocks())
+ {
+ LOG_PRINT_CCONTEXT_L0("Failure in cleanup_handle_incoming_blocks");
+ return 1;
+ }
+
// in case the peer had dropped beforehand, remove the span anyway so other threads can wake up and get it
m_block_queue.remove_spans(span_connection_id, start_height);
return 1;
@@ -1108,7 +1132,11 @@ skip:
MCINFO("sync-info", "Block process time (" << blocks.size() << " blocks, " << num_txs << " txs): " << block_process_time_full + transactions_process_time_full << " (" << transactions_process_time_full << "/" << block_process_time_full << ") ms");
- m_core.cleanup_handle_incoming_blocks();
+ if (!m_core.cleanup_handle_incoming_blocks())
+ {
+ LOG_PRINT_CCONTEXT_L0("Failure in cleanup_handle_incoming_blocks");
+ return 1;
+ }
m_block_queue.remove_spans(span_connection_id, start_height);