fixup! Less strict handling of faulty rpc req params and syntax improvement

This commit is contained in:
Emilia Hane 2023-01-18 18:52:18 +01:00
parent b4ec4c1ccf
commit a00b355800
No known key found for this signature in database
GPG Key ID: E73394F9C09206FA

View File

@ -5858,27 +5858,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.flatten() .flatten()
} }
/// The epoch since which we cater blob data upon a request 'ByRoot'. /// The epoch that is a data availability boundary, or the latest finalized epoch.
/// `None` if the `Eip4844` fork is disabled. /// `None` if the `Eip4844` fork is disabled.
pub fn data_availability_boundary_by_root_rpc_request(&self) -> Option<Epoch> { pub fn finalized_data_availability_boundary(&self) -> Option<Epoch> {
self.spec self.data_availability_boundary().map(|boundary| {
.eip4844_fork_epoch std::cmp::max(
.map(|fork_epoch| { boundary,
self.epoch().ok().map(|current_epoch| { self.canonical_head
vec![ .cached_head()
fork_epoch, .finalized_checkpoint()
current_epoch.saturating_sub(*MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS), .epoch,
self.canonical_head )
.cached_head() })
.finalized_checkpoint()
.epoch,
]
.into_iter()
.max()
})
})
.flatten()
.flatten()
} }
/// Returns `true` if we are at or past the `Eip4844` fork. This will always return `false` if /// Returns `true` if we are at or past the `Eip4844` fork. This will always return `false` if