Skip to content

Commit

Permalink
eth/catalyst: make getPayloadBodiesByRange take hex
Browse files Browse the repository at this point in the history
  • Loading branch information
jwasinger committed Feb 7, 2023
1 parent 91cb6f8 commit 6e6ff10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,18 +772,18 @@ 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 uint64) ([]*engine.ExecutionPayloadBodyV1, error) {
func (api *ConsensusAPI) GetPayloadBodiesByRangeV1(start, count hexutil.Uint64) ([]*engine.ExecutionPayloadBodyV1, error) {
if start == 0 || count == 0 || count > 1024 {
return nil, engine.InvalidParams.With(fmt.Errorf("invalid start or count, start: %v count: %v", start, count))
}
// limit count up until current
current := api.eth.BlockChain().CurrentBlock().NumberU64()
end := start + count
end := uint64(start) + uint64(count)
if end > current {
end = current
}
var bodies []*engine.ExecutionPayloadBodyV1
for i := start; i < end; i++ {
for i := uint64(start); i < end; i++ {
block := api.eth.BlockChain().GetBlockByNumber(i)
bodies = append(bodies, getBody(block))
}
Expand Down
8 changes: 4 additions & 4 deletions eth/catalyst/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,8 @@ func TestGetBlockBodiesByRange(t *testing.T) {

tests := []struct {
results []*types.Body
start uint64
count uint64
start hexutil.Uint64
count hexutil.Uint64
}{
// Genesis
{
Expand Down Expand Up @@ -1367,8 +1367,8 @@ func TestGetBlockBodiesByRangeInvalidParams(t *testing.T) {
defer node.Close()

tests := []struct {
start uint64
count uint64
start hexutil.Uint64
count hexutil.Uint64
}{
// Genesis
{
Expand Down

0 comments on commit 6e6ff10

Please sign in to comment.