mirror of
https://github.com/monero-project/monero.git
synced 2025-07-30 06:08:44 -04:00
Merge pull request #5346
c84ea299
cryptonote_basic: some more minor speedups (moneromooo-monero)e40eb2ad
cryptonote_basic: speedup calculate_block_hash (moneromooo-monero)547a9708
cryptonote: block parsing + hash calculation speedup (moneromooo-monero)11604b6d
blockchain: avoid unneeded block copy (moneromooo-monero)8461df04
save some database calls when getting top block hash and height (moneromooo-monero)3bbc3661
Avoid repeated (de)serialization when syncing (moneromooo-monero)
This commit is contained in:
commit
4ac78e1612
6 changed files with 65 additions and 20 deletions
|
@ -995,7 +995,8 @@ namespace cryptonote
|
|||
return 1;
|
||||
}
|
||||
|
||||
if(!parse_and_validate_block_from_blob(block_entry.block, b))
|
||||
crypto::hash block_hash;
|
||||
if(!parse_and_validate_block_from_blob(block_entry.block, b, block_hash))
|
||||
{
|
||||
LOG_ERROR_CCONTEXT("sent wrong block: failed to parse and validate block: "
|
||||
<< epee::string_tools::buff_to_hex_nodelimer(block_entry.block) << ", dropping connection");
|
||||
|
@ -1014,7 +1015,6 @@ namespace cryptonote
|
|||
if (start_height == std::numeric_limits<uint64_t>::max())
|
||||
start_height = boost::get<txin_gen>(b.miner_tx.vin[0]).height;
|
||||
|
||||
const crypto::hash block_hash = get_block_hash(b);
|
||||
auto req_it = context.m_requested_objects.find(block_hash);
|
||||
if(req_it == context.m_requested_objects.end())
|
||||
{
|
||||
|
@ -1121,13 +1121,13 @@ namespace cryptonote
|
|||
<< ", we need " << previous_height);
|
||||
|
||||
block new_block;
|
||||
if (!parse_and_validate_block_from_blob(blocks.back().block, new_block))
|
||||
crypto::hash last_block_hash;
|
||||
if (!parse_and_validate_block_from_blob(blocks.back().block, new_block, last_block_hash))
|
||||
{
|
||||
MERROR(context << "Failed to parse block, but it should already have been parsed");
|
||||
m_block_queue.remove_spans(span_connection_id, start_height);
|
||||
continue;
|
||||
}
|
||||
const crypto::hash last_block_hash = cryptonote::get_block_hash(new_block);
|
||||
if (m_core.have_block(last_block_hash))
|
||||
{
|
||||
const uint64_t subchain_height = start_height + blocks.size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue