Warn if a requested blob was not returned

This commit is contained in:
Giacomo Pasini 2024-01-19 14:19:14 +01:00
parent 3cfffaed97
commit 5664b2fd63
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
1 changed files with 12 additions and 1 deletions

View File

@ -20,5 +20,16 @@ pub async fn get_block_blobs(node: &Url, block: &BlockId) -> Result<Vec<Blob>, E
.await?
.ok_or(Error::NotFound)?;
Ok(get_blobs(node, block.blobs().map(|cert| cert.blob()).collect()).await?)
let blobs = block.blobs().map(|cert| cert.blob()).collect::<Vec<_>>();
if blobs.is_empty() {
return Ok(vec![]);
}
let n_blobs = blobs.len();
let resp = get_blobs(node, blobs).await?;
if resp.len() != n_blobs {
tracing::warn!("Only {}/{} blobs returned", resp.len(), n_blobs);
}
Ok(resp)
}