From 84b10a3f0fe7366512fd220b0c3edbe14082897d Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sun, 14 Apr 2024 21:06:36 -0400 Subject: [PATCH] Comments, logging. --- include/bitcoin/node/impl/chasers/chaser_organize.ipp | 6 ++++-- src/chasers/chaser_check.cpp | 1 + src/chasers/chaser_preconfirm.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/bitcoin/node/impl/chasers/chaser_organize.ipp b/include/bitcoin/node/impl/chasers/chaser_organize.ipp index 004bf8cf..8c55cbf8 100644 --- a/include/bitcoin/node/impl/chasers/chaser_organize.ipp +++ b/include/bitcoin/node/impl/chasers/chaser_organize.ipp @@ -359,6 +359,10 @@ void CLASS::do_organize(typename Block::cptr& block_ptr, // Delay so headers can get current before block download starts. // Checking currency before notify also avoids excessive work backlog. + + // If all headers are previously associated then no blocks will be fed to + // preconfirmation, resulting in a stall... + if (is_block() || is_current(header.timestamp())) notify(error::success, chase_object(), branch_point); @@ -465,8 +469,6 @@ void CLASS::do_disorganize(header_t link) NOEXCEPT for (auto index = top_candidate; index > fork_point; --index) { - LOGN("Reorganizing candidate [" << index << "]."); - if (!query.pop_candidate()) { fault(error::store_integrity); diff --git a/src/chasers/chaser_check.cpp b/src/chasers/chaser_check.cpp index 20564ac1..fe4297fe 100644 --- a/src/chasers/chaser_check.cpp +++ b/src/chasers/chaser_check.cpp @@ -119,6 +119,7 @@ void chaser_check::handle_event(const code&, chase event_, // add headers // ---------------------------------------------------------------------------- +// TODO: create a tracking map with hashes only? // Due to a race with header organization more current headers and branch // points may be created while preceding headers messages are in transit. That // can result in the branch->top scan finding the same unassociated headers diff --git a/src/chasers/chaser_preconfirm.cpp b/src/chasers/chaser_preconfirm.cpp index 26fce351..41cb88f8 100644 --- a/src/chasers/chaser_preconfirm.cpp +++ b/src/chasers/chaser_preconfirm.cpp @@ -61,6 +61,11 @@ void chaser_preconfirm::handle_event(const code&, chase event_, POST(do_checked, height_t{}); break; } + case chase::header: + { + POST(do_checked, height_t{}); + break; + } case chase::checked: { POST(do_height_checked, possible_narrow_cast(value)); @@ -84,7 +89,7 @@ void chaser_preconfirm::handle_event(const code&, chase event_, case chase::stall: case chase::purge: case chase::block: - case chase::header: + ////case chase::header: case chase::download: ////case chase::checked: case chase::unchecked: