mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 05:07:12 +00:00
Add range sync machinery on sync side
This commit is contained in:
@@ -60,7 +60,8 @@ use lighthouse_network::service::api_types::{
|
||||
BlobsByRangeRequestId, BlocksByRangeRequestId, ComponentsByRangeRequestId,
|
||||
CustodyBackFillBatchRequestId, CustodyBackfillBatchId, CustodyRequester,
|
||||
DataColumnsByRangeRequestId, DataColumnsByRangeRequester, DataColumnsByRootRequestId,
|
||||
DataColumnsByRootRequester, Id, SingleLookupReqId, SyncRequestId,
|
||||
DataColumnsByRootRequester, Id, PayloadEnvelopesByRangeRequestId, SingleLookupReqId,
|
||||
SyncRequestId,
|
||||
};
|
||||
use lighthouse_network::types::{NetworkGlobals, SyncState};
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
@@ -522,6 +523,8 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
SyncRequestId::SinglePayloadEnvelope { id } => {
|
||||
self.on_single_envelope_response(id, peer_id, RpcEvent::RPCError(error))
|
||||
}
|
||||
SyncRequestId::PayloadEnvelopesByRange(req_id) => self
|
||||
.on_payload_envelopes_by_range_response(req_id, peer_id, RpcEvent::RPCError(error)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1262,8 +1265,15 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
peer_id,
|
||||
RpcEvent::from_chunk(envelope, seen_timestamp),
|
||||
),
|
||||
SyncRequestId::PayloadEnvelopesByRange(req_id) => {
|
||||
self.on_payload_envelopes_by_range_response(
|
||||
req_id,
|
||||
peer_id,
|
||||
RpcEvent::from_chunk(envelope, seen_timestamp),
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
crit!(%peer_id, "bad request id for payload envelope");
|
||||
crit!(%peer_id, "bad request id for payload_envelope");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1302,6 +1312,24 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn on_payload_envelopes_by_range_response(
|
||||
&mut self,
|
||||
id: PayloadEnvelopesByRangeRequestId,
|
||||
peer_id: PeerId,
|
||||
envelope: RpcEvent<Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>>,
|
||||
) {
|
||||
if let Some(resp) = self
|
||||
.network
|
||||
.on_payload_envelopes_by_range_response(id, peer_id, envelope)
|
||||
{
|
||||
self.on_range_components_response(
|
||||
id.parent_request_id,
|
||||
peer_id,
|
||||
RangeBlockComponent::PayloadEnvelope(id, resp),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn on_single_blob_response(
|
||||
&mut self,
|
||||
id: SingleLookupReqId,
|
||||
|
||||
Reference in New Issue
Block a user