Skip to content

Commit

Permalink
add request limit to getHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
Aratz M. Lasa committed Jun 1, 2023
1 parent 45cacc0 commit 33e3b5b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ func (rs *Relay) GetHeader(ctx context.Context, m *structs.MetricGroup, uc struc
})

logger.Info("header requested")

slotStart := int64(rs.beaconState.Genesis().GenesisTime+(uint64(slot)*12)) * 1000
now := time.Now().UnixMilli()
msIntoSlot := now - slotStart
if msIntoSlot > int64(rs.config.GetPayloadRequestTimeLimit.Milliseconds()) {
logger.WithField("msIntoSlot", msIntoSlot).Debug("requested too late")
return nil, ErrLateRequest
}
logger = logger.WithField("msIntoSlot", msIntoSlot)

tGet := time.Now()

maxProfit, ok := rs.a.MaxProfitBlock(slot, parentHash)
Expand Down

0 comments on commit 33e3b5b

Please sign in to comment.