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

Block relay improvements (take 2) #1911

Merged
merged 7 commits into from
Aug 30, 2023
Merged
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions crates/sc-subspace-block-relay/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::protocol::compact_block::{CompactBlockClient, CompactBlockServer};
use crate::utils::{NetworkPeerHandle, NetworkWrapper, RequestResponseErr};
use crate::{ProtocolBackend, ProtocolClient, ProtocolServer, RelayError, LOG_TARGET};
use async_trait::async_trait;
use codec::{Decode, Encode};
use codec::{Compact, CompactLen, Decode, Encode};
use futures::channel::oneshot;
use futures::stream::StreamExt;
use lru::LruCache;
Expand Down Expand Up @@ -453,7 +453,8 @@ where
FromBlock::Number(n) => BlockId::<Block>::Number(n),
};

let mut total_size: usize = 0;
// This is a compact length encoding of max number of blocks to be sent in response
rahulksnv marked this conversation as resolved.
Show resolved Hide resolved
let mut total_size = Compact::compact_len(&MAX_RESPONSE_BLOCKS.get());
let max_blocks = block_request.max.map_or(MAX_RESPONSE_BLOCKS.into(), |val| {
std::cmp::min(val, MAX_RESPONSE_BLOCKS.into())
});
Expand Down