steem icon indicating copy to clipboard operation
steem copied to clipboard

Feature / Add 'get_blocks_in_range' API method

Open steemchiller opened this issue 2 years ago • 0 comments

Description

This adds the new API method get_blocks_in_range to the block_api and condenser_api to enable requesting a specified range of blocks at once. The default query limit is set to 250 blocks, but it can be changed to a higher limit in the config.ini (for example, we can set it to 1000 with query-limit-get-blocks-in-range = 1000).

Result

If all blocks in the requested range exist, the request result is an array of blocks and the first element of the returned array contains the first block of the range, the second the next one and so on.

In case an invalid range was requested or a block inside the range does not exist, a corresponding error message will be returned.

Examples

block_api

curl -s --data '{"jsonrpc":"2.0", "method":"block_api.get_blocks_in_range", "params":{"from_num":60000001,"to_num":60000250}, "id":1}' http://127.0.0.1:8090 | python3 -m json.tool

condenser_api

curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_blocks_in_range", "params":[60000001,60000250], "id":1}' http://127.0.0.1:8090 | python3 -m json.tool

steemchiller avatar Mar 21 '22 20:03 steemchiller