mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Improve RangeBlockComponent type
This commit is contained in:
@@ -1237,21 +1237,9 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
|||||||
id: CustodyByRangeRequestId,
|
id: CustodyByRangeRequestId,
|
||||||
result: CustodyRequestResult<T::EthSpec>,
|
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(
|
self.on_block_components_by_range_response(
|
||||||
id.parent_request_id,
|
id.parent_request_id,
|
||||||
RangeBlockComponent::CustodyColumns(
|
RangeBlockComponent::CustodyColumns(id, result),
|
||||||
id,
|
|
||||||
result.map(|(data, _peers, timestamp)| (data, timestamp)),
|
|
||||||
peers,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,11 +240,7 @@ pub enum RangeBlockComponent<E: EthSpec> {
|
|||||||
RpcResponseResult<Vec<Arc<BlobSidecar<E>>>>,
|
RpcResponseResult<Vec<Arc<BlobSidecar<E>>>>,
|
||||||
PeerId,
|
PeerId,
|
||||||
),
|
),
|
||||||
CustodyColumns(
|
CustodyColumns(CustodyByRangeRequestId, CustodyRequestResult<E>),
|
||||||
CustodyByRangeRequestId,
|
|
||||||
RpcResponseResult<Vec<Arc<DataColumnSidecar<E>>>>,
|
|
||||||
PeerGroup,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -1462,8 +1458,8 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
|||||||
.on_blobs_by_range_result(req_id, blobs, peer_id, self)
|
.on_blobs_by_range_result(req_id, blobs, peer_id, self)
|
||||||
.map_err(Into::<RpcResponseError>::into)
|
.map_err(Into::<RpcResponseError>::into)
|
||||||
}),
|
}),
|
||||||
RangeBlockComponent::CustodyColumns(req_id, resp, peers) => {
|
RangeBlockComponent::CustodyColumns(req_id, resp) => {
|
||||||
resp.and_then(|(custody_columns, _)| {
|
resp.and_then(|(custody_columns, peers, _)| {
|
||||||
request
|
request
|
||||||
.on_custody_by_range_result(req_id, custody_columns, peers, self)
|
.on_custody_by_range_result(req_id, custody_columns, peers, self)
|
||||||
.map_err(Into::<RpcResponseError>::into)
|
.map_err(Into::<RpcResponseError>::into)
|
||||||
|
|||||||
Reference in New Issue
Block a user