From 355cab87040d4beaa37d3140cf999f275b708460 Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Wed, 4 Jan 2023 01:57:15 +1100 Subject: [PATCH] Simplify `blob_sidecar` query and remove override for `Head` and `Slot` --- beacon_node/http_api/src/block_id.rs | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/beacon_node/http_api/src/block_id.rs b/beacon_node/http_api/src/block_id.rs index f08e4c200..fd45e14fa 100644 --- a/beacon_node/http_api/src/block_id.rs +++ b/beacon_node/http_api/src/block_id.rs @@ -217,32 +217,7 @@ impl BlockId { &self, chain: &BeaconChain, ) -> Result<(Arc>), warp::Rejection> { - let root = match &self.0 { - CoreBlockId::Head => { - let (cached_head, _execution_status) = chain - .canonical_head - .head_and_execution_status() - .map_err(warp_utils::reject::beacon_chain_error)?; - cached_head.head_block_root() - } - CoreBlockId::Slot(slot) => { - let maybe_block_root = chain - .block_root_at_slot(*slot, WhenSlotSkipped::None) - .ok() - .flatten(); - match maybe_block_root { - Some(block_root) => block_root, - None => { - return Err(warp_utils::reject::custom_not_found(format!( - "Block root for slot {} not found", - slot - ))) - } - } - } - _ => self.root(chain)?.0, - }; - + let root = self.root(chain)?.0; match chain.store.get_blobs(&root) { Ok(Some(blob)) => Ok((Arc::new(blob))), Ok(None) => Err(warp_utils::reject::custom_not_found(format!(