aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-13 21:03:04 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-18 16:29:00 +0100
commit7adceee634354f9291de8dd021669d7ca5cf3f2a (patch)
tree30743bd5eaddab868baba6e19bc3aace6e68951c /src/cryptonote_protocol
parentMerge pull request #2446 (diff)
downloadmonero-7adceee634354f9291de8dd021669d7ca5cf3f2a.tar.xz
precomputed block hashes are now in blocks of N (currently 256)
This shaves a lot of space off binaries
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 803d948cc..f599e0c8d 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -1583,10 +1583,22 @@ skip:
return 1;
}
+ uint64_t n_use_blocks = m_core.prevalidate_block_hashes(arg.start_height, arg.m_block_ids);
+ if (n_use_blocks == 0)
+ {
+ LOG_ERROR_CCONTEXT("Peer yielded no usable blocks, dropping connection");
+ drop_connection(context, false, false);
+ return 1;
+ }
+
+ uint64_t added = 0;
for(auto& bl_id: arg.m_block_ids)
{
context.m_needed_objects.push_back(bl_id);
+ if (++added == n_use_blocks)
+ break;
}
+ context.m_last_response_height -= arg.m_block_ids.size() - n_use_blocks;
if (!request_missing_objects(context, false))
{