From d304c27e2abff5c7b97f09e2c0d6c77055f73192 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Wed, 4 Jun 2025 02:41:44 -0400 Subject: [PATCH] Fix get_locator_span lower limit. --- include/bitcoin/database/impl/query/network.ipp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/bitcoin/database/impl/query/network.ipp b/include/bitcoin/database/impl/query/network.ipp index 318648b6a..55717e748 100644 --- a/include/bitcoin/database/impl/query/network.ipp +++ b/include/bitcoin/database/impl/query/network.ipp @@ -79,7 +79,6 @@ CLASS::span CLASS::get_locator_span(const hashes& locator, const hash_digest& stop, size_t limit) const NOEXCEPT { using namespace system; - span out{}; // Start at fork point, stop at given header (both excluded). const auto start = add1(get_fork(locator)); @@ -94,9 +93,12 @@ CLASS::span CLASS::get_locator_span(const hashes& locator, const auto top1 = ceilinged_add(get_top_confirmed(), one); const auto end = std::min(ceilinged_add(start, allowed), top1); - // Convert negative range to empty. - out.end = std::max(start, end); - return out; + // max converts negative range to empty. + return + { + start, + std::max(start, end) + }; } // protected