diff --git a/datastore/auction_api.go b/datastore/auction_api.go index 446a2710..6f29ce24 100644 --- a/datastore/auction_api.go +++ b/datastore/auction_api.go @@ -27,6 +27,7 @@ func GetPayloadContents(slot uint64, proposerPubkey, blockHash string) (*builder if err != nil { return nil, err } + defer resp.Body.Close() if resp.StatusCode == 404 { return nil, ErrExecutionPayloadNotFound @@ -60,6 +61,11 @@ func GetBidTrace(slot uint64, proposerPubkey, blockHash string) (*common.BidTrac if err != nil { return nil, err } + defer resp.Body.Close() + + if resp.StatusCode == 404 { + return nil, ErrBidTraceNotFound + } body, err := io.ReadAll(resp.Body) if err != nil { diff --git a/datastore/datastore.go b/datastore/datastore.go index 4e5e9e0b..19508b88 100644 --- a/datastore/datastore.go +++ b/datastore/datastore.go @@ -21,6 +21,7 @@ import ( ) var ErrExecutionPayloadNotFound = errors.New("execution payload not found") +var ErrBidTraceNotFound = errors.New("bidtrace not found") type GetHeaderResponseKey struct { Slot uint64