Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the flow of execution of light-base/sync/relay #1383

Merged
merged 8 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/src/sync/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1878,13 +1878,15 @@ pub enum DesiredRequest {

impl DesiredRequest {
/// Caps the number of blocks to request to `max`.
// TODO: consider removing due to the many types of requests
pub fn num_blocks_clamp(&mut self, max: NonZeroU64) {
if let DesiredRequest::BlocksRequest { num_blocks, .. } = self {
*num_blocks = NonZeroU64::new(cmp::min(num_blocks.get(), max.get())).unwrap();
}
}

/// Caps the number of blocks to request to `max`.
// TODO: consider removing due to the many types of requests
pub fn with_num_blocks_clamp(mut self, max: NonZeroU64) -> Self {
self.num_blocks_clamp(max);
self
Expand Down
Loading
Loading