Skip to content

ibd: price new getdata at the recent block-size max - #868

Merged
reardencode merged 1 commit into
masterfrom
ibd/getdata-reserve-max
Oct 2, 2026
Merged

reardencode merged 1 commit into
masterfrom
ibd/getdata-reserve-max

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

IBD prices a newly issued unique getdata hash against the assign-stop at the largest wire length among the most recent 32 requested bodies, and never above 4 MiB. Until eight bodies have been recorded, that charge stays 4 MiB. A hash already in flight is still issued when the remaining budget cannot fit another new hash.

The per-peer in-flight cap is unchanged: the median of recent bodies, 1 KiB until eight samples, then 64 blocks or 16 MiB of that median, whichever is reached first. The 1,024-hash download window and the 1 GiB assign-stop are unchanged.

Test plan

  • cargo test -p rbitcoin-net --lib intake_reserve_charges_max_of_recent_bodies
  • cargo test -p rbitcoin-net --lib peer_block_room_is_count_until_bodies_have_a_size
  • cargo fmt --all -- --check
  • cargo clippy -p rbitcoin-net --all-targets -- -D warnings

A flat 4 MiB charge against the 1 GiB assign-stop closed new getdata
once the body queue neared that stop, while recent blocks were much
smaller. After eight recorded bodies, a new unique hash is charged the
largest wire length among the last 32, and never above 4 MiB. Fewer
than eight samples still cost 4 MiB. A hash already in flight is still
issued. The per-peer cap stays the median of recent bodies (1 KiB until
eight), then 64 blocks or 16 MiB.
@reardencode
reardencode merged commit 41bda36 into master Oct 2, 2026
18 checks passed
@rearden-grok
rearden-grok Bot deleted the ibd/getdata-reserve-max branch October 4, 2026 16:06
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