Skip to content

Commit

Permalink
Check if blobs are expired before returning (#695)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Raynor <[email protected]>
  • Loading branch information
mooselumph and Robert Raynor authored Aug 12, 2024
1 parent a24d0ad commit f2d2d9c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions disperser/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,12 @@ func (s *DispersalServer) RetrieveBlob(ctx context.Context, req *pb.RetrieveBlob
return nil, api.NewInternalError("failed to get blob metadata, please retry")
}

if blobMetadata.Expiry < uint64(time.Now().Unix()) {
s.metrics.HandleNotFoundRpcRequest("RetrieveBlob")
s.metrics.HandleNotFoundRequest("RetrieveBlob")
return nil, api.NewNotFoundError("no metadata found for the given batch header hash and blob index")
}

// Check throughout rate limit
blobSize := encoding.GetBlobSize(blobMetadata.ConfirmationInfo.BlobCommitment.Length)

Expand Down

0 comments on commit f2d2d9c

Please sign in to comment.