Merge pull request #2469

7adceee6 precomputed block hashes are now in blocks of N (currently 256) (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-10-15 17:23:50 +02:00
commit 5ea20d6944
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
12 changed files with 182 additions and 12 deletions

View file

@ -1579,10 +1579,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))
{