mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Improve RangeBlockComponent type
This commit is contained in:
@@ -1237,21 +1237,9 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
id: CustodyByRangeRequestId,
|
||||
result: CustodyRequestResult<T::EthSpec>,
|
||||
) {
|
||||
// TODO(das): Improve the type of RangeBlockComponent::CustodyColumns, not
|
||||
// not have to pass a PeerGroup in case of error
|
||||
let peers = match &result {
|
||||
Ok((_, peers, _)) => peers.clone(),
|
||||
// TODO(das): this PeerGroup with no peers incorrect
|
||||
Err(_) => PeerGroup::from_set(<_>::default()),
|
||||
};
|
||||
|
||||
self.on_block_components_by_range_response(
|
||||
id.parent_request_id,
|
||||
RangeBlockComponent::CustodyColumns(
|
||||
id,
|
||||
result.map(|(data, _peers, timestamp)| (data, timestamp)),
|
||||
peers,
|
||||
),
|
||||
RangeBlockComponent::CustodyColumns(id, result),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -240,11 +240,7 @@ pub enum RangeBlockComponent<E: EthSpec> {
|
||||
RpcResponseResult<Vec<Arc<BlobSidecar<E>>>>,
|
||||
PeerId,
|
||||
),
|
||||
CustodyColumns(
|
||||
CustodyByRangeRequestId,
|
||||
RpcResponseResult<Vec<Arc<DataColumnSidecar<E>>>>,
|
||||
PeerGroup,
|
||||
),
|
||||
CustodyColumns(CustodyByRangeRequestId, CustodyRequestResult<E>),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -1462,8 +1458,8 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
.on_blobs_by_range_result(req_id, blobs, peer_id, self)
|
||||
.map_err(Into::<RpcResponseError>::into)
|
||||
}),
|
||||
RangeBlockComponent::CustodyColumns(req_id, resp, peers) => {
|
||||
resp.and_then(|(custody_columns, _)| {
|
||||
RangeBlockComponent::CustodyColumns(req_id, resp) => {
|
||||
resp.and_then(|(custody_columns, peers, _)| {
|
||||
request
|
||||
.on_custody_by_range_result(req_id, custody_columns, peers, self)
|
||||
.map_err(Into::<RpcResponseError>::into)
|
||||
|
||||
Reference in New Issue
Block a user