Skip to content

Commit

Permalink
Style, logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Mar 15, 2024
1 parent dbfa7bf commit f9121b5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/protocols/protocol_block_in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ get_blocks protocol_block_in::create_get_inventory() const NOEXCEPT
// This will bypass all blocks with candidate headers, resulting in block
// orphans if headers-first is run followed by a restart and blocks-first.
const auto& query = archive();
return create_get_inventory(query.get_candidate_hashes(get_blocks::heights(
query.get_top_candidate())));
const auto index = get_blocks::heights(query.get_top_candidate());
return create_get_inventory(query.get_candidate_hashes(index));
}

get_blocks protocol_block_in::create_get_inventory(
Expand All @@ -228,8 +228,19 @@ get_blocks protocol_block_in::create_get_inventory(
get_blocks protocol_block_in::create_get_inventory(
hashes&& hashes) const NOEXCEPT
{
LOGP("Request (" << hashes .size() << ") blocks after ["
<< encode_hash(hashes.front()) << "] from [" << authority() << "].");
if (hashes.empty())
return {};

if (hashes.size() == one)
{
LOGP("Request block inventory after [" << encode_hash(hashes.back())
<< "] from [" << authority() << "].");
}
else
{
LOGP("Request block inventory (" << hashes.size() << ") after ["
<< encode_hash(hashes.back()) << "] from [" << authority() << "].");
}

return { std::move(hashes) };
}
Expand Down

0 comments on commit f9121b5

Please sign in to comment.