avoid pointlessly full blocks while handle blobsidecar REST requests (#5668)

This commit is contained in:
tersec 2023-12-14 17:02:36 +00:00 committed by GitHub
parent 44db870f59
commit 13c9f3b1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -1394,11 +1394,10 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
router.api(MethodGet, "/eth/v1/beacon/blob_sidecars/{block_id}") do (
block_id: BlockIdent, indices: seq[uint64]) -> RestApiResponse:
let
bid = block_id.valueOr:
blockIdent = block_id.valueOr:
return RestApiResponse.jsonError(Http400, InvalidBlockIdValueError,
$error)
bdata = node.getForkedBlock(bid).valueOr:
bid = node.getBlockId(blockIdent).valueOr:
return RestApiResponse.jsonError(Http404, BlockNotFoundError)
contentType = block:
@ -1423,7 +1422,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
var blobSidecar = new BlobSidecar
if node.dag.db.getBlobSidecar(bdata.root, blobIndex, blobSidecar[]):
if node.dag.db.getBlobSidecar(bid.root, blobIndex, blobSidecar[]):
discard data[].add blobSidecar[]
return