From 2ef080a51b5982e4e2ce17953f2a9cc62edf13fa Mon Sep 17 00:00:00 2001 From: lhofhansl Date: Thu, 25 Jan 2024 11:32:18 -0800 Subject: [PATCH] Slight simplification of RemoteClient::getNextBlocks(...) (#14302) --- src/clientiface.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/clientiface.cpp b/src/clientiface.cpp index f76ef0a882d5..e6849a5b4965 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -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 @@ -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;