mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 10:52:43 +00:00
Nest lookup type into request id SingleBlock and SingleBlob (#5562)
* Nest lookup type into block lookup RequestId
This commit is contained in:
@@ -7,7 +7,6 @@ use super::range_sync::{BatchId, ByRangeRequestType, ChainId};
|
||||
use crate::network_beacon_processor::NetworkBeaconProcessor;
|
||||
use crate::service::{NetworkMessage, RequestId};
|
||||
use crate::status::ToStatusMessage;
|
||||
use crate::sync::block_lookups::common::LookupType;
|
||||
use crate::sync::manager::SingleLookupReqId;
|
||||
use beacon_chain::block_verification_types::RpcBlock;
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes, EngineState};
|
||||
@@ -437,27 +436,20 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
id: SingleLookupReqId,
|
||||
peer_id: PeerId,
|
||||
request: BlocksByRootRequest,
|
||||
lookup_type: LookupType,
|
||||
) -> Result<(), &'static str> {
|
||||
let sync_id = match lookup_type {
|
||||
LookupType::Current => SyncRequestId::SingleBlock { id },
|
||||
LookupType::Parent => SyncRequestId::ParentLookup { id },
|
||||
};
|
||||
let request_id = RequestId::Sync(sync_id);
|
||||
|
||||
debug!(
|
||||
self.log,
|
||||
"Sending BlocksByRoot Request";
|
||||
"method" => "BlocksByRoot",
|
||||
"block_roots" => ?request.block_roots().to_vec(),
|
||||
"peer" => %peer_id,
|
||||
"lookup_type" => ?lookup_type
|
||||
"id" => ?id
|
||||
);
|
||||
|
||||
self.send_network_msg(NetworkMessage::SendRequest {
|
||||
peer_id,
|
||||
request: Request::BlocksByRoot(request),
|
||||
request_id,
|
||||
request_id: RequestId::Sync(SyncRequestId::SingleBlock { id }),
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -467,14 +459,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
id: SingleLookupReqId,
|
||||
blob_peer_id: PeerId,
|
||||
blob_request: BlobsByRootRequest,
|
||||
lookup_type: LookupType,
|
||||
) -> Result<(), &'static str> {
|
||||
let sync_id = match lookup_type {
|
||||
LookupType::Current => SyncRequestId::SingleBlob { id },
|
||||
LookupType::Parent => SyncRequestId::ParentLookupBlob { id },
|
||||
};
|
||||
let request_id = RequestId::Sync(sync_id);
|
||||
|
||||
if let Some(block_root) = blob_request
|
||||
.blob_ids
|
||||
.as_slice()
|
||||
@@ -494,13 +479,13 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
"block_root" => ?block_root,
|
||||
"blob_indices" => ?indices,
|
||||
"peer" => %blob_peer_id,
|
||||
"lookup_type" => ?lookup_type
|
||||
"id" => ?id
|
||||
);
|
||||
|
||||
self.send_network_msg(NetworkMessage::SendRequest {
|
||||
peer_id: blob_peer_id,
|
||||
request: Request::BlobsByRoot(blob_request),
|
||||
request_id,
|
||||
request_id: RequestId::Sync(SyncRequestId::SingleBlob { id }),
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user