Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove "to_block" field from BlockRequests #12447

Merged
merged 2 commits into from
Oct 8, 2022
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: 0 additions & 2 deletions client/network/common/src/sync/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ pub mod generic {
pub fields: BlockAttributes,
/// Start from this block.
pub from: FromBlock<Hash, Number>,
/// End at this block. An implementation defined maximum is used when unspecified.
pub to: Option<Hash>,
/// Sequence direction.
pub direction: Direction,
/// Maximum number of blocks to return. An implementation defined maximum is used when
Expand Down
9 changes: 1 addition & 8 deletions client/network/sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ where
id: 0,
fields: BlockAttributes::JUSTIFICATION,
from: FromBlock::Hash(request.0),
to: None,
direction: Direction::Ascending,
max: Some(1),
};
Expand Down Expand Up @@ -1608,7 +1607,6 @@ where
FromBlock::Number(n) =>
Some(schema::v1::block_request::FromBlock::Number(n.encode())),
},
to_block: request.to.map(|h| h.encode()).unwrap_or_default(),
direction: request.direction as i32,
max_blocks: request.max.unwrap_or(0),
support_multiple_justifications: true,
Expand Down Expand Up @@ -2252,7 +2250,6 @@ fn ancestry_request<B: BlockT>(block: NumberFor<B>) -> BlockRequest<B> {
id: 0,
fields: BlockAttributes::HEADER | BlockAttributes::JUSTIFICATION,
from: FromBlock::Number(block),
to: None,
direction: Direction::Ascending,
max: Some(1),
}
Expand Down Expand Up @@ -2368,7 +2365,6 @@ fn peer_block_request<B: BlockT>(
id: 0,
fields: attrs,
from,
to: None,
direction: Direction::Descending,
max: Some((range.end - range.start).saturated_into::<u32>()),
};
Expand Down Expand Up @@ -2402,7 +2398,6 @@ fn peer_gap_block_request<B: BlockT>(
id: 0,
fields: attrs,
from,
to: None,
direction: Direction::Descending,
max: Some((range.end - range.start).saturated_into::<u32>()),
};
Expand Down Expand Up @@ -2452,7 +2447,6 @@ fn fork_sync_request<B: BlockT>(
id: 0,
fields: attributes,
from: FromBlock::Hash(*hash),
to: None,
direction: Direction::Descending,
max: Some(count),
},
Expand Down Expand Up @@ -2702,8 +2696,7 @@ mod test {
assert!(sync.justification_requests().any(|(p, r)| {
p == peer_id3 &&
r.fields == BlockAttributes::JUSTIFICATION &&
r.from == FromBlock::Hash(b1_hash) &&
r.to == None
r.from == FromBlock::Hash(b1_hash)
}));

assert_eq!(
Expand Down
2 changes: 0 additions & 2 deletions client/network/sync/src/schema/api.v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ message BlockRequest {
// Start with given block number.
bytes number = 3;
}
// End at this block. An implementation defined maximum is used when unspecified.
bytes to_block = 4; // optional
// Sequence direction.
Direction direction = 5;
// Maximum number of blocks to return. An implementation defined maximum is used when unspecified.
Expand Down
1 change: 0 additions & 1 deletion client/network/sync/src/warp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ where
fields: BlockAttributes::HEADER |
BlockAttributes::BODY | BlockAttributes::JUSTIFICATION,
from: FromBlock::Hash(header.hash()),
to: Some(header.hash()),
direction: Direction::Ascending,
max: Some(1),
};
Expand Down