forked from cerc-io/plugeth
eth/catalyst: request too large error (#26722)
The method `GetPayloadBodiesByRangeV1` now returns "-38004: Too large request" error if the requested range is too large, according to spec Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
co-authored by
Martin Holst Swende
parent
6428663faf
commit
15e5e6176b
+4
-1
@@ -785,9 +785,12 @@ func (api *ConsensusAPI) GetPayloadBodiesByHashV1(hashes []common.Hash) []*engin
|
||||
// GetPayloadBodiesByRangeV1 implements engine_getPayloadBodiesByRangeV1 which allows for retrieval of a range
|
||||
// of block bodies by the engine api.
|
||||
func (api *ConsensusAPI) GetPayloadBodiesByRangeV1(start, count hexutil.Uint64) ([]*engine.ExecutionPayloadBodyV1, error) {
|
||||
if start == 0 || count == 0 || count > 1024 {
|
||||
if start == 0 || count == 0 {
|
||||
return nil, engine.InvalidParams.With(fmt.Errorf("invalid start or count, start: %v count: %v", start, count))
|
||||
}
|
||||
if count > 1024 {
|
||||
return nil, engine.TooLargeRequest.With(fmt.Errorf("requested count too large: %v", count))
|
||||
}
|
||||
// limit count up until current
|
||||
current := api.eth.BlockChain().CurrentBlock().NumberU64()
|
||||
last := uint64(start) + uint64(count) - 1
|
||||
|
||||
Reference in New Issue
Block a user