use of org.aion.zero.impl.db.AionBlockStore in project aion by aionnetwork.
the class ApiWeb3Aion method debug_getBlocksByNumber.
/* -------------------------------------------------------------------------
* debug
*/
public Object debug_getBlocksByNumber(String _bnOrId, boolean _fullTransactions) {
Long bn = parseBnOrId(_bnOrId);
if (bn == null || bn < 0)
return null;
List<Map.Entry<AionBlock, Map.Entry<BigInteger, Boolean>>> blocks = ((AionBlockStore) this.ac.getAionHub().getBlockchain().getBlockStore()).getBlocksByNumber(bn);
if (blocks == null) {
LOG.debug("<get-block bn={} err=not-found>");
return null;
}
JSONArray response = new JSONArray();
for (Map.Entry<AionBlock, Map.Entry<BigInteger, Boolean>> block : blocks) {
JSONObject b = (JSONObject) Blk.AionBlockToJson(block.getKey(), block.getValue().getKey(), _fullTransactions);
b.put("mainchain", block.getValue().getValue());
response.put(b);
}
return response;
}
Aggregations