Skip to content

Commit

Permalink
Alter save builder submissions to all bids
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed Feb 8, 2024
1 parent d8a0d7b commit 0a489d5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions services/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,7 @@ func (api *RelayAPI) checkFloorBidValue(opts bidFloorOpts) (*big.Int, bool) {
if err != nil && !errors.Is(err, redis.Nil) {
opts.log.WithError(err).Error("failed to get delivered payload slot from redis")
} else if opts.submission.BidTrace.Slot <= slotLastPayloadDelivered {
opts.simResultC <- &blockSimResult{false, false, nil, nil}
opts.log.Info("rejecting submission because payload for this slot was already delivered")
api.RespondError(opts.w, http.StatusBadRequest, "payload for this slot was already delivered")
return nil, false
Expand Down Expand Up @@ -2008,19 +2009,6 @@ func (api *RelayAPI) handleSubmitNewBlock(w http.ResponseWriter, req *http.Reque
return
}

bfOpts := bidFloorOpts{
w: w,
tx: tx,
log: log,
cancellationsEnabled: isCancellationEnabled,
simResultC: simResultC,
submission: submission,
}
floorBidValue, ok := api.checkFloorBidValue(bfOpts)
if !ok {
return
}

// Deferred saving of the builder submission to database (whenever this function ends)
defer func() {
savePayloadToDatabase := !api.ffDisablePayloadDBStorage
Expand All @@ -2044,6 +2032,19 @@ func (api *RelayAPI) handleSubmitNewBlock(w http.ResponseWriter, req *http.Reque
}
}()

bfOpts := bidFloorOpts{
w: w,
tx: tx,
log: log,
cancellationsEnabled: isCancellationEnabled,
simResultC: simResultC,
submission: submission,
}
floorBidValue, ok := api.checkFloorBidValue(bfOpts)
if !ok {
return
}

// ---------------------------------
// THE BID WILL BE SIMULATED SHORTLY
// ---------------------------------
Expand Down

0 comments on commit 0a489d5

Please sign in to comment.