ibd: price new getdata at the recent block-size max - #868
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_bodiescargo test -p rbitcoin-net --lib peer_block_room_is_count_until_bodies_have_a_sizecargo fmt --all -- --checkcargo clippy -p rbitcoin-net --all-targets -- -D warnings