Skip to content

Commit

Permalink
Slight simplification of RemoteClient::getNextBlocks(...) (#14302)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhofhansl committed Jan 25, 2024
1 parent 4468813 commit 2ef080a
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/clientiface.cpp
Expand Up @@ -345,11 +345,13 @@ void RemoteClient::GetNextBlocks (
if (m_blocks_sent.find(p) != m_blocks_sent.end())
continue;

bool block_not_found = false;
if (block) {
// Check whether the block exists (with data)
if (!block->isGenerated())
block_not_found = true;
/*
If block is not generated and generating new ones is
not wanted, skip block.
*/
if (!block->isGenerated() && !generate)
continue;

/*
If block is not close, don't send it unless it is near
Expand Down Expand Up @@ -379,19 +381,10 @@ void RemoteClient::GetNextBlocks (
continue;
}

/*
If block has been marked to not exist on disk (dummy) or is
not generated and generating new ones is not wanted, skip block.
*/
if (!generate && block_not_found) {
// get next one.
continue;
}

/*
Add inexistent block to emerge queue.
*/
if (block == NULL || block_not_found) {
if (!block || !block->isGenerated()) {
if (emerge->enqueueBlockEmerge(peer_id, p, generate)) {
if (nearest_emerged_d == -1)
nearest_emerged_d = d;
Expand Down

0 comments on commit 2ef080a

Please sign in to comment.