Skip to content

Commit

Permalink
[fix] redis.GetBidTrace should return err=redis.Nil on missing it…
Browse files Browse the repository at this point in the history
…em (#468)

redis.GetBidTrace fix on missing item
  • Loading branch information
metachris authored Jun 18, 2023
1 parent b0ee7d4 commit b954716
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions datastore/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,11 @@ func (r *RedisCache) SaveBidTrace(ctx context.Context, tx redis.Pipeliner, trace
return r.SetObjPipelined(ctx, tx, key, trace, expiryBidCache)
}

// GetBidTrace returns (trace, nil), or (nil, redis.Nil) if the trace does not exist
func (r *RedisCache) GetBidTrace(slot uint64, proposerPubkey, blockHash string) (*common.BidTraceV2, error) {
key := r.keyCacheBidTrace(slot, proposerPubkey, blockHash)
resp := new(common.BidTraceV2)
err := r.GetObj(key, resp)
if errors.Is(err, redis.Nil) {
return nil, nil
}
return resp, err
}

Expand Down

0 comments on commit b954716

Please sign in to comment.