Work in progress block separation

This commit is contained in:
Michael Sproul
2022-09-16 17:32:22 +10:00
parent 7d3948c8fe
commit 2bd784ef68
21 changed files with 204 additions and 29 deletions

View File

@@ -693,7 +693,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let root = self.block_root_at_slot(request_slot, skips)?;
if let Some(block_root) = root {
Ok(self.store.get_blinded_block(&block_root)?)
Ok(self
.store
.get_blinded_block(&block_root, Some(request_slot))?)
} else {
Ok(None)
}
@@ -919,7 +921,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
) -> Result<Option<SignedBeaconBlock<T::EthSpec>>, Error> {
// Load block from database, returning immediately if we have the full block w payload
// stored.
let blinded_block = match self.store.try_get_full_block(block_root)? {
let blinded_block = match self.store.try_get_full_block(block_root, None)? {
Some(DatabaseBlock::Full(block)) => return Ok(Some(block)),
Some(DatabaseBlock::Blinded(block)) => block,
None => return Ok(None),
@@ -975,7 +977,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
&self,
block_root: &Hash256,
) -> Result<Option<SignedBlindedBeaconBlock<T::EthSpec>>, Error> {
Ok(self.store.get_blinded_block(block_root)?)
Ok(self.store.get_blinded_block(block_root, None)?)
}
/// Returns the state at the given root, if any.
@@ -4629,7 +4631,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let beacon_block = self
.store
.get_blinded_block(&beacon_block_root)?
.get_blinded_block(&beacon_block_root, None)?
.ok_or_else(|| {
Error::DBInconsistent(format!("Missing block {}", beacon_block_root))
})?;