Skip to content

bch(M5): drop evicted-then-arrived block from the download queue - #204

Merged
frstrtr merged 1 commit into
masterfrom
bch/m5-blockdl-evicted-arrival
Jun 19, 2026
Merged

bch(M5): drop evicted-then-arrived block from the download queue#204
frstrtr merged 1 commit into
masterfrom
bch/m5-blockdl-evicted-arrival

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

bch(M5): drop evicted-then-arrived block from the download queue

expire() requeues a timed-out in-flight block to the FRONT of the pending
queue and records it in m_evicted. If the (merely slow) peer then delivers
that block, on_block_received bumped false_evict_count but left the hash in
the queue -- so the next next_requests() drain re-getdata'd a block already
in hand. Remove the hash from the queue on the false-evict path (linear scan;
eviction is rare, healthy sync keeps false_evict at 0). A hash already
re-issued sits in m_in_flight, not the queue, so the scan is a no-op there.

Adds an evicted-then-arrived test pinning both legs: false_evict_count flags
the premature eviction (distinct from a clean arrival) AND queued()==0 / a
following drain is empty -- no re-download. Refreshes the stale header note
that still claimed eviction was deferred (it is implemented and NodeP2P-driven).

PURE block-download window plumbing; p2pool-merged-v36 surface NONE; per-coin
isolation src/impl/bch/ only; header + test build-inert (bch skip-green).

expire() requeues a timed-out in-flight block to the FRONT of the pending
queue and records it in m_evicted. If the (merely slow) peer then delivers
that block, on_block_received bumped false_evict_count but left the hash in
the queue -- so the next next_requests() drain re-getdata'd a block already
in hand. Remove the hash from the queue on the false-evict path (linear scan;
eviction is rare, healthy sync keeps false_evict at 0). A hash already
re-issued sits in m_in_flight, not the queue, so the scan is a no-op there.

Adds an evicted-then-arrived test pinning both legs: false_evict_count flags
the premature eviction (distinct from a clean arrival) AND queued()==0 / a
following drain is empty -- no re-download. Refreshes the stale header note
that still claimed eviction was deferred (it is implemented and NodeP2P-driven).

PURE block-download window plumbing; p2pool-merged-v36 surface NONE; per-coin
isolation src/impl/bch/ only; header + test build-inert (bch skip-green).
@frstrtr
frstrtr merged commit 04de91a into master Jun 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant