File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 56
56
// ErrHeadersLimitExceeded is returned when ExchangeServer receives header request for more
57
57
// than maxRequestSize headers.
58
58
ErrHeadersLimitExceeded = errors .New ("header/p2p: header limit per 1 request exceeded" )
59
+
60
+ // ErrRangeMixUp is returned when `from` >= `to`.
61
+ ErrRangeMixUp = errors .New ("header/p2p: `from` must be less than `to`" )
59
62
)
60
63
61
64
// Store encompasses the behavior necessary to store and retrieve Headers
Original file line number Diff line number Diff line change @@ -203,6 +203,10 @@ func (serv *ExchangeServer[H]) handleRangeRequest(
203
203
ctx context.Context ,
204
204
from , to uint64 ,
205
205
) ([]H , error ) {
206
+ if from >= to {
207
+ return nil , header .ErrRangeMixUp
208
+ }
209
+
206
210
if from == uint64 (0 ) {
207
211
return serv .handleHeadRequest (ctx )
208
212
}
You can’t perform that action at this time.
0 commit comments