mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-17 18:58:23 +00:00
Use correct slot in custody request
This commit is contained in:
@@ -288,6 +288,7 @@ enum DataDownload<E: EthSpec> {
|
||||
},
|
||||
Columns {
|
||||
block_root: Hash256,
|
||||
slot: Slot,
|
||||
state: SingleLookupRequestState<DataColumnSidecarList<E>>,
|
||||
},
|
||||
}
|
||||
@@ -309,9 +310,13 @@ impl<E: EthSpec> DataDownload<E> {
|
||||
let eb = *expected_blobs;
|
||||
state.make_request(|| cx.blob_lookup_request(id, peers, br, eb))
|
||||
}
|
||||
DataDownload::Columns { block_root, state } => {
|
||||
DataDownload::Columns {
|
||||
block_root,
|
||||
slot,
|
||||
state,
|
||||
} => {
|
||||
let br = *block_root;
|
||||
state.make_request(|| cx.custody_lookup_request(id, br, peers))
|
||||
state.make_request(|| cx.custody_lookup_request(id, br, *slot, peers))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -447,6 +452,7 @@ impl<E: EthSpec> DataRequestState<E> {
|
||||
if expected_blobs > 0 {
|
||||
Self::Downloading(DataDownload::Columns {
|
||||
block_root,
|
||||
slot,
|
||||
state: SingleLookupRequestState::new_with_processing_failures(
|
||||
failed_processing,
|
||||
),
|
||||
@@ -459,6 +465,7 @@ impl<E: EthSpec> DataRequestState<E> {
|
||||
if expected_blobs > 0 {
|
||||
Self::Downloading(DataDownload::Columns {
|
||||
block_root,
|
||||
slot,
|
||||
state: SingleLookupRequestState::new_with_processing_failures(
|
||||
failed_processing,
|
||||
),
|
||||
|
||||
@@ -1179,34 +1179,18 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
&mut self,
|
||||
lookup_id: SingleLookupId,
|
||||
block_root: Hash256,
|
||||
block_slot: Slot,
|
||||
lookup_peers: Arc<RwLock<HashSet<PeerId>>>,
|
||||
) -> Result<LookupRequestResult, RpcRequestSendError> {
|
||||
let slot = self
|
||||
.chain
|
||||
.canonical_head
|
||||
.fork_choice_read_lock()
|
||||
.get_block(&block_root)
|
||||
.map(|block| block.slot)
|
||||
.or_else(|| self.chain.slot().ok())
|
||||
.ok_or_else(|| {
|
||||
RpcRequestSendError::InternalError(format!(
|
||||
"Unable to determine slot for block {block_root:?}"
|
||||
))
|
||||
})?;
|
||||
|
||||
let custody_indexes_imported = self
|
||||
.chain
|
||||
.cached_data_column_indexes(&block_root, slot)
|
||||
.cached_data_column_indexes(&block_root, block_slot)
|
||||
.unwrap_or_default();
|
||||
|
||||
let current_epoch = self.chain.epoch().map_err(|e| {
|
||||
RpcRequestSendError::InternalError(format!("Unable to read slot clock {:?}", e))
|
||||
})?;
|
||||
|
||||
// Include only the blob indexes not yet imported (received through gossip)
|
||||
let mut custody_indexes_to_fetch = self
|
||||
.chain
|
||||
.sampling_columns_for_epoch(current_epoch)
|
||||
.sampling_columns_for_epoch(block_slot.epoch(T::EthSpec::slots_per_epoch()))
|
||||
.iter()
|
||||
.copied()
|
||||
.filter(|index| !custody_indexes_imported.contains(index))
|
||||
|
||||
Reference in New Issue
Block a user