@Test public void getBlockByHeight() throws Exception { Map<String,Object> params = new HashMap<>(); long blockHeight = 53L; params.put(Constants.CHAIN_ID, chainId); params.put("height", blockHeight); Response cmdResp = ResponseMessageProcessor.requestAndResponse(ModuleE.BL.abbr, GET_BLOCK_BY_HEIGHT, params); Map data = (Map) cmdResp.getResponseData(); Map result = (Map) data.get(GET_BLOCK_BY_HEIGHT); String hex = (String) result.get("value"); Block block100 = new Block(); block100.parse(new NulsByteBuffer(HexUtil.decode(hex))); Log.info("block: {}", JSONUtils.obj2PrettyJson(block100)); Assert.assertEquals(blockHeight, block100.getHeader().getHeight()); }
@CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) public Response getBlockByHeight(Map map) { try { int chainId = Integer.parseInt(map.get(Constants.CHAIN_ID).toString()); ChainContext context = ContextManager.getContext(chainId); if (context == null) { return success(); } long height = Long.parseLong(map.get("height").toString()); Block block = service.getBlock(chainId, height); Map<String, String> responseData = new HashMap<>(2); if (block == null) { return success(responseData); } responseData.put("value", RPCUtil.encode(block.serialize())); return success(responseData); } catch (Exception e) { COMMON_LOG.error("", e); return failed(e.getMessage()); } }
BlockResource extends BaseCmd { @CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) public Response getBlockByHeight(Map map) { try { int chainId = Integer.parseInt(map.get(Constants.CHAIN_ID).toString()); ChainContext context = ContextManager.getContext(chainId); if (context == null) { return success(); } long height = Long.parseLong(map.get("height").toString()); Block block = service.getBlock(chainId, height); Map<String, String> responseData = new HashMap<>(2); if (block == null) { return success(responseData); } responseData.put("value", RPCUtil.encode(block.serialize())); return success(responseData); } catch (Exception e) { COMMON_LOG.error("", e); return failed(e.getMessage()); } } }
BlockResource extends BaseCmd { @CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) public Response getBlockByHeight(Map map) { try { int chainId = Integer.parseInt(map.get(Constants.CHAIN_ID).toString()); ChainContext context = ContextManager.getContext(chainId); if (context == null) { return success(); } long height = Long.parseLong(map.get("height").toString()); Block block = service.getBlock(chainId, height); Map<String, String> responseData = new HashMap<>(2); if (block == null) { return success(responseData); } responseData.put("value", RPCUtil.encode(block.serialize())); return success(responseData); } catch (Exception e) { COMMON_LOG.error("", e); return failed(e.getMessage()); } }  }
BlockResource extends BaseCmd { @CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) public Response getBlockByHeight(Map map) { try { int chainId = Integer.parseInt(map.get(Constants.CHAIN_ID).toString()); ChainContext context = ContextManager.getContext(chainId); if (context == null) { return success(); } long height = Long.parseLong(map.get("height").toString()); Block block = service.getBlock(chainId, height); Map<String, String> responseData = new HashMap<>(2); if (block == null) { return success(responseData); } responseData.put("value", RPCUtil.encode(block.serialize())); return success(responseData); } catch (Exception e) { COMMON_LOG.error("", e); return failed(e.getMessage()); } }  @CmdAnnotation(cmd = INFO, version = 1.0, description = "returns network node height and local node height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个Map对象，包含两个属性", responseType = @TypeDescriptor(value = Map.class, mapKeys = { @Key(name = "networkHeight", valueType = Long.class, description = "网络节点最新区块高度"), @Key(name = "localHeight", valueType = Long.class, description = "本地节点最新区块高度")}) ) Response info(Map map); @CmdAnnotation(cmd = LATEST_HEIGHT, version = 1.0, description = "the latest height of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个Map对象，包含一个属性", responseType = @TypeDescriptor(value = Map.class, mapKeys = { @Key(name = "value", valueType = Long.class, description = "最新主链高度")}) ) Response latestHeight(Map map); @CmdAnnotation(cmd = LATEST_BLOCK_HEADER, version = 1.0, description = "the latest block header of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个区块头序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response latestBlockHeader(Map map); @CmdAnnotation(cmd = LATEST_BLOCK_HEADER_PO, version = 1.0, description = "the latest block header po of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个区块头PO序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response latestBlockHeaderPo(Map map); @CmdAnnotation(cmd = LATEST_BLOCK, version = 1.0, description = "the latest block of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个区块序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response bestBlock(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_BY_HEIGHT, version = 1.0, description = "get a block header by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回一个区块头序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderByHeight(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_PO_BY_HEIGHT, version = 1.0, description = "get a block header po by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回一个区块头PO序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderPoByHeight(Map map); @CmdAnnotation(cmd = GET_LATEST_BLOCK_HEADERS, version = 1.0, description = "get the latest number of block headers") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "size", requestType = @TypeDescriptor(value = int.class), parameterDes = "数量") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getLatestBlockHeaders(Map map); @CmdAnnotation(cmd = GET_ROUND_BLOCK_HEADERS, version = 1.0, description = "get the latest several rounds of block headers") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "起始高度"), @Parameter(parameterName = "round", requestType = @TypeDescriptor(value = int.class), parameterDes = "共识轮次") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getRoundBlockHeaders(Map map); @CmdAnnotation(cmd = GET_LATEST_ROUND_BLOCK_HEADERS, version = 1.0, description = "get the latest several rounds of block headers") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "round", requestType = @TypeDescriptor(value = int.class), parameterDes = "共识轮次") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getLatestRoundBlockHeaders(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADERS_FOR_PROTOCOL, version = 1.0, description = "get block headers for protocol upgrade module") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "interval", requestType = @TypeDescriptor(value = int.class), parameterDes = "协议升级统计区间") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getBlockHeadersForProtocol(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADERS_BY_HEIGHT_RANGE, version = 1.0, description = "get the block headers according to the height range") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "begin", requestType = @TypeDescriptor(value = long.class), parameterDes = "起始高度"), @Parameter(parameterName = "end", requestType = @TypeDescriptor(value = long.class), parameterDes = "结束高度") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getBlockHeadersByHeightRange(Map map); @CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) Response getBlockByHeight(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_BY_HASH, version = 1.0, description = "get a block header by hash") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "hash", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块hash") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderByHash(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_PO_BY_HASH, version = 1.0, description = "get a block header po by hash") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "hash", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块hash") }) @ResponseData(name = "返回值", description = "返回区块头PO序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderPoByHash(Map map); @CmdAnnotation(cmd = GET_BLOCK_BY_HASH, version = 1.0, description = "get a block by hash") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "hash", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块hash") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockByHash(Map map); @CmdAnnotation(cmd = RECEIVE_PACKING_BLOCK, version = 1.0, description = "receive the new packaged block") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "block", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块序列化后的HEX字符串") }) @ResponseData(name = "返回值", description = "无返回值") Response receivePackingBlock(Map map); @CmdAnnotation(cmd = GET_STATUS, version = 1.0, description = "receive the new packaged block") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个Map对象，包含一个属性", responseType = @TypeDescriptor(value = Map.class, mapKeys = { @Key(name = "status", valueType = Integer.class, description = "运行状态")}) ) Response getStatus(Map map); }
BlockResource extends BaseCmd { @CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) public Response getBlockByHeight(Map map) { try { int chainId = Integer.parseInt(map.get(Constants.CHAIN_ID).toString()); ChainContext context = ContextManager.getContext(chainId); if (context == null) { return success(); } long height = Long.parseLong(map.get("height").toString()); Block block = service.getBlock(chainId, height); Map<String, String> responseData = new HashMap<>(2); if (block == null) { return success(responseData); } responseData.put("value", RPCUtil.encode(block.serialize())); return success(responseData); } catch (Exception e) { COMMON_LOG.error("", e); return failed(e.getMessage()); } }  @CmdAnnotation(cmd = INFO, version = 1.0, description = "returns network node height and local node height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个Map对象，包含两个属性", responseType = @TypeDescriptor(value = Map.class, mapKeys = { @Key(name = "networkHeight", valueType = Long.class, description = "网络节点最新区块高度"), @Key(name = "localHeight", valueType = Long.class, description = "本地节点最新区块高度")}) ) Response info(Map map); @CmdAnnotation(cmd = LATEST_HEIGHT, version = 1.0, description = "the latest height of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个Map对象，包含一个属性", responseType = @TypeDescriptor(value = Map.class, mapKeys = { @Key(name = "value", valueType = Long.class, description = "最新主链高度")}) ) Response latestHeight(Map map); @CmdAnnotation(cmd = LATEST_BLOCK_HEADER, version = 1.0, description = "the latest block header of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个区块头序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response latestBlockHeader(Map map); @CmdAnnotation(cmd = LATEST_BLOCK_HEADER_PO, version = 1.0, description = "the latest block header po of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个区块头PO序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response latestBlockHeaderPo(Map map); @CmdAnnotation(cmd = LATEST_BLOCK, version = 1.0, description = "the latest block of master chain") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个区块序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response bestBlock(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_BY_HEIGHT, version = 1.0, description = "get a block header by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回一个区块头序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderByHeight(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_PO_BY_HEIGHT, version = 1.0, description = "get a block header po by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回一个区块头PO序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderPoByHeight(Map map); @CmdAnnotation(cmd = GET_LATEST_BLOCK_HEADERS, version = 1.0, description = "get the latest number of block headers") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "size", requestType = @TypeDescriptor(value = int.class), parameterDes = "数量") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getLatestBlockHeaders(Map map); @CmdAnnotation(cmd = GET_ROUND_BLOCK_HEADERS, version = 1.0, description = "get the latest several rounds of block headers") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "起始高度"), @Parameter(parameterName = "round", requestType = @TypeDescriptor(value = int.class), parameterDes = "共识轮次") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getRoundBlockHeaders(Map map); @CmdAnnotation(cmd = GET_LATEST_ROUND_BLOCK_HEADERS, version = 1.0, description = "get the latest several rounds of block headers") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "round", requestType = @TypeDescriptor(value = int.class), parameterDes = "共识轮次") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getLatestRoundBlockHeaders(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADERS_FOR_PROTOCOL, version = 1.0, description = "get block headers for protocol upgrade module") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "interval", requestType = @TypeDescriptor(value = int.class), parameterDes = "协议升级统计区间") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getBlockHeadersForProtocol(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADERS_BY_HEIGHT_RANGE, version = 1.0, description = "get the block headers according to the height range") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "begin", requestType = @TypeDescriptor(value = long.class), parameterDes = "起始高度"), @Parameter(parameterName = "end", requestType = @TypeDescriptor(value = long.class), parameterDes = "结束高度") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串List", responseType = @TypeDescriptor(value = List.class, collectionElement = String.class)) Response getBlockHeadersByHeightRange(Map map); @CmdAnnotation(cmd = GET_BLOCK_BY_HEIGHT, version = 1.0, description = "get a block by height") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "height", requestType = @TypeDescriptor(value = long.class), parameterDes = "区块高度") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串List", responseType = @TypeDescriptor(value = String.class)) Response getBlockByHeight(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_BY_HASH, version = 1.0, description = "get a block header by hash") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "hash", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块hash") }) @ResponseData(name = "返回值", description = "返回区块头序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderByHash(Map map); @CmdAnnotation(cmd = GET_BLOCK_HEADER_PO_BY_HASH, version = 1.0, description = "get a block header po by hash") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "hash", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块hash") }) @ResponseData(name = "返回值", description = "返回区块头PO序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockHeaderPoByHash(Map map); @CmdAnnotation(cmd = GET_BLOCK_BY_HASH, version = 1.0, description = "get a block by hash") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "hash", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块hash") }) @ResponseData(name = "返回值", description = "返回区块序列化后的HEX字符串", responseType = @TypeDescriptor(value = String.class)) Response getBlockByHash(Map map); @CmdAnnotation(cmd = RECEIVE_PACKING_BLOCK, version = 1.0, description = "receive the new packaged block") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID"), @Parameter(parameterName = "block", requestType = @TypeDescriptor(value = String.class), parameterDes = "区块序列化后的HEX字符串") }) @ResponseData(name = "返回值", description = "无返回值") Response receivePackingBlock(Map map); @CmdAnnotation(cmd = GET_STATUS, version = 1.0, description = "receive the new packaged block") @Parameters({ @Parameter(parameterName = "chainId", requestType = @TypeDescriptor(value = int.class), parameterDes = "链ID") }) @ResponseData(name = "返回值", description = "返回一个Map对象，包含一个属性", responseType = @TypeDescriptor(value = Map.class, mapKeys = { @Key(name = "status", valueType = Integer.class, description = "运行状态")}) ) Response getStatus(Map map);  }