use of org.ethereum.db.BlockInformation in project rskj by rsksmart.
the class Web3Impl method eth_getBlocksByNumber.
public BlockInformationResult[] eth_getBlocksByNumber(String number) {
long blockNumber;
try {
blockNumber = TypeConverter.stringNumberAsBigInt(number).longValue();
} catch (NumberFormatException | StringIndexOutOfBoundsException e) {
throw new JsonRpcInvalidParamException("invalid blocknumber " + number);
}
List<BlockInformationResult> result = new ArrayList<>();
List<BlockInformation> binfos = blockchain.getBlocksInformationByNumber(blockNumber);
for (BlockInformation binfo : binfos) {
result.add(getBlockInformationResult(binfo));
}
return result.toArray(new BlockInformationResult[result.size()]);
}
Aggregations