mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
compile after merge
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use beacon_chain::blob_verification::{AsBlock, BlockWrapper};
|
||||
use beacon_chain::data_availability_checker::{DataAvailabilityChecker};
|
||||
use beacon_chain::data_availability_checker::DataAvailabilityChecker;
|
||||
use beacon_chain::{AvailabilityProcessingStatus, BeaconChainTypes, BlockError};
|
||||
use lighthouse_network::rpc::RPCError;
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
@@ -60,7 +60,7 @@ pub(crate) struct BlockLookups<T: BeaconChainTypes> {
|
||||
SingleBlockLookup<SINGLE_BLOCK_LOOKUP_MAX_ATTEMPTS, T>,
|
||||
)>,
|
||||
|
||||
da_checker: Arc<DataAvailabilityChecker<T::EthSpec, T::SlotClock>>,
|
||||
da_checker: Arc<DataAvailabilityChecker<T>>,
|
||||
|
||||
/// The logger for the import manager.
|
||||
log: Logger,
|
||||
@@ -121,10 +121,7 @@ pub enum ShouldRemoveLookup {
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
pub fn new(
|
||||
da_checker: Arc<DataAvailabilityChecker<T::EthSpec, T::SlotClock>>,
|
||||
log: Logger,
|
||||
) -> Self {
|
||||
pub fn new(da_checker: Arc<DataAvailabilityChecker<T>>, log: Logger) -> Self {
|
||||
Self {
|
||||
parent_lookups: Default::default(),
|
||||
processing_parent_lookups: Default::default(),
|
||||
@@ -540,7 +537,8 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
if !outstanding_blobs_req {
|
||||
if let Ok(peer_id) = parent_lookup
|
||||
.current_parent_request
|
||||
.downloading_peer(ResponseType::Blob) {
|
||||
.downloading_peer(ResponseType::Blob)
|
||||
{
|
||||
cx.report_peer(
|
||||
peer_id.to_peer_id(),
|
||||
PeerAction::MidToleranceError,
|
||||
@@ -622,9 +620,11 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
seen_timestamp: Duration,
|
||||
cx: &mut SyncNetworkContext<T>,
|
||||
) {
|
||||
let mut parent_lookup = if let Some(pos) = self.parent_lookups.iter().position(|request| {
|
||||
request.pending_blob_response(id)
|
||||
}) {
|
||||
let mut parent_lookup = if let Some(pos) = self
|
||||
.parent_lookups
|
||||
.iter()
|
||||
.position(|request| request.pending_blob_response(id))
|
||||
{
|
||||
self.parent_lookups.remove(pos)
|
||||
} else {
|
||||
if blob.is_some() {
|
||||
@@ -1055,7 +1055,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
cx,
|
||||
&self.log,
|
||||
)
|
||||
} else if let Some(block_id_ref) = block_id_ref {
|
||||
} else if let Some(block_id_ref) = block_id_ref {
|
||||
// Try it again if possible.
|
||||
retry_request_after_failure(
|
||||
block_id_ref,
|
||||
@@ -1488,8 +1488,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn handle_block_lookup_verify_error<T: BeaconChainTypes>(
|
||||
request_id_ref: &mut u32,
|
||||
request_ref: &mut SingleBlockLookup<SINGLE_BLOCK_LOOKUP_MAX_ATTEMPTS, T>,
|
||||
|
||||
@@ -63,25 +63,6 @@ pub enum RequestError {
|
||||
NoPeers,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LookupDownloadStatus<T: EthSpec> {
|
||||
Process(BlockWrapper<T>),
|
||||
SearchBlock(Hash256),
|
||||
AvailabilityCheck(AvailabilityCheckError),
|
||||
}
|
||||
|
||||
impl<T: EthSpec> From<Result<BlockWrapper<T>, AvailabilityCheckError>> for LookupDownloadStatus<T> {
|
||||
fn from(value: Result<BlockWrapper<T>, AvailabilityCheckError>) -> Self {
|
||||
match value {
|
||||
Ok(wrapper) => LookupDownloadStatus::Process(wrapper),
|
||||
Err(AvailabilityCheckError::MissingBlobs(block_root)) => {
|
||||
LookupDownloadStatus::SearchBlock(block_root)
|
||||
}
|
||||
Err(e) => LookupDownloadStatus::AvailabilityCheck(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> ParentLookup<T> {
|
||||
pub fn contains_block(&self, block_root: &Hash256) -> bool {
|
||||
self.downloaded_blocks
|
||||
@@ -93,7 +74,7 @@ impl<T: BeaconChainTypes> ParentLookup<T> {
|
||||
block_root: Hash256,
|
||||
parent_root: Hash256,
|
||||
peer_id: PeerShouldHave,
|
||||
da_checker: Arc<DataAvailabilityChecker<T::EthSpec, T::SlotClock>>,
|
||||
da_checker: Arc<DataAvailabilityChecker<T>>,
|
||||
) -> Self {
|
||||
let current_parent_request =
|
||||
SingleBlockLookup::new(parent_root, Some(<_>::default()), peer_id, da_checker);
|
||||
@@ -189,10 +170,7 @@ impl<T: BeaconChainTypes> ParentLookup<T> {
|
||||
Some(UnknownParentComponents::default());
|
||||
}
|
||||
|
||||
pub fn add_current_request_block(
|
||||
&mut self,
|
||||
block: Arc<SignedBeaconBlock<T::EthSpec>>,
|
||||
) {
|
||||
pub fn add_current_request_block(&mut self, block: Arc<SignedBeaconBlock<T::EthSpec>>) {
|
||||
// Cache the block.
|
||||
self.current_parent_request.add_unknown_parent_block(block);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ pub struct SingleBlockLookup<const MAX_ATTEMPTS: u8, T: BeaconChainTypes> {
|
||||
pub blob_download_queue: FixedBlobSidecarList<T::EthSpec>,
|
||||
pub block_request_state: SingleLookupRequestState<MAX_ATTEMPTS>,
|
||||
pub blob_request_state: SingleLookupRequestState<MAX_ATTEMPTS>,
|
||||
pub da_checker: Arc<DataAvailabilityChecker<T::EthSpec, T::SlotClock>>,
|
||||
pub da_checker: Arc<DataAvailabilityChecker<T>>,
|
||||
/// Only necessary for requests triggered by an `UnkownParent` because any
|
||||
/// blocks or blobs without parents won't hit the data availability cache.
|
||||
pub unknown_parent_components: Option<UnknownParentComponents<T::EthSpec>>,
|
||||
@@ -110,7 +110,7 @@ impl<const MAX_ATTEMPTS: u8, T: BeaconChainTypes> SingleBlockLookup<MAX_ATTEMPTS
|
||||
requested_block_root: Hash256,
|
||||
unknown_parent_components: Option<UnknownParentComponents<T::EthSpec>>,
|
||||
peer_source: PeerShouldHave,
|
||||
da_checker: Arc<DataAvailabilityChecker<T::EthSpec, T::SlotClock>>,
|
||||
da_checker: Arc<DataAvailabilityChecker<T>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
requested_block_root,
|
||||
|
||||
Reference in New Issue
Block a user