fixup! Simplify conceptual design
This commit is contained in:
parent
7103a257ce
commit
20567750c1
@ -918,13 +918,10 @@ where
|
||||
if beacon_chain.store.get_config().prune_blobs {
|
||||
let store = beacon_chain.store.clone();
|
||||
let log = log.clone();
|
||||
let current_slot = beacon_chain
|
||||
.slot()
|
||||
.map_err(|e| format!("Failed to get current slot: {:?}", e))?;
|
||||
let current_epoch = current_slot.epoch(TEthSpec::slots_per_epoch());
|
||||
let data_availability_boundary = beacon_chain.data_availability_boundary();
|
||||
beacon_chain.task_executor.spawn_blocking(
|
||||
move || {
|
||||
if let Err(e) = store.try_prune_blobs(false, Some(current_epoch)) {
|
||||
if let Err(e) = store.try_prune_blobs(false, data_availability_boundary) {
|
||||
error!(log, "Error pruning blobs in background"; "error" => ?e);
|
||||
}
|
||||
},
|
||||
|
@ -1018,11 +1018,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if self.store.get_config().prune_blobs {
|
||||
let store = self.store.clone();
|
||||
let log = self.log.clone();
|
||||
let current_slot = self.slot()?;
|
||||
let current_epoch = current_slot.epoch(T::EthSpec::slots_per_epoch());
|
||||
let data_availability_boundary = self.data_availability_boundary();
|
||||
self.task_executor.spawn_blocking(
|
||||
move || {
|
||||
if let Err(e) = store.try_prune_blobs(false, Some(current_epoch)) {
|
||||
if let Err(e) = store.try_prune_blobs(false, data_availability_boundary) {
|
||||
error!(log, "Error pruning blobs in background"; "error" => ?e);
|
||||
}
|
||||
},
|
||||
|
@ -1735,7 +1735,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
||||
// finalized epoch, hence current_epoch = split_epoch + 1
|
||||
let current_epoch =
|
||||
self.get_split_slot().epoch(E::slots_per_epoch()) + Epoch::new(1);
|
||||
current_epoch - *MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS
|
||||
current_epoch.saturating_sub(*MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS)
|
||||
}
|
||||
};
|
||||
|
||||
@ -1757,12 +1757,23 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
||||
|
||||
let mut ops = vec![];
|
||||
let mut last_pruned_block_root = None;
|
||||
let end_slot = next_epoch_to_prune.start_slot(E::slots_per_epoch());
|
||||
let end_slot = next_epoch_to_prune.end_slot(E::slots_per_epoch());
|
||||
|
||||
// todo(emhane): In the future, if the data availability boundary is less than the split
|
||||
// epoch, this code will have to change to account for head candidates.
|
||||
for res in self.forwards_block_roots_iterator_until(
|
||||
oldest_blob_slot,
|
||||
end_slot,
|
||||
|| Err(HotColdDBError::UnsupportedDataAvailabilityBoundary.into()),
|
||||
|| {
|
||||
let split = self.get_split_info();
|
||||
|
||||
let split_state = self.get_state(&split.state_root, Some(split.slot))?.ok_or(
|
||||
HotColdDBError::MissingSplitState(split.state_root, split.slot),
|
||||
)?;
|
||||
let split_block_root = split_state.get_latest_block_root(split.state_root);
|
||||
|
||||
Ok((split_state, split_block_root))
|
||||
},
|
||||
&self.spec,
|
||||
)? {
|
||||
let (block_root, slot) = match res {
|
||||
|
Loading…
Reference in New Issue
Block a user