getConsensusStatus

返回指定群组内的共识状态信息

参数

  • groupID: unsigned int - 群组ID

返回值

  • object - 共识状态信息。

    • 当共识机制为PBFT时(PBFT详细设计参考PBFT设计文档),字段如下:
    • accountType: unsigned int - 账户类型
    • allowFutureBlocks: bool - 允许未来块标志
    • cfgErr: bool - 配置错误标志
    • connectedNodes: unsigned int - 连接的节点数
    • consensusedBlockNumber: unsigned int - 下一个共识的最新块高
    • currentView: unsigned int - 当前视图
    • groupId: unsigned int - 群组ID
    • highestblockHash: string - 最新块哈希
    • highestblockNumber: unsigned int - 最新区块高度
    • leaderFailed: bool - leader失败标志
    • max_faulty_leader: unsigned int - 最大容错节点数
    • sealer.index: string - 节点序号为index的nodeId
    • node index: unsigned int - 节点的序号
    • nodeId: string - 节点的ID
    • nodeNum: unsigned int - 节点的数
    • omitEmptyBlock: bool - 忽略空块标志位
    • protocolId: unsigned int - 协议ID号
    • toView: unsigned int - 目前到达的view值
    • prepareCache_blockHash: string - prepareCache哈希
    • prepareCache_height: int- prepareCache高度
    • prepareCache_idx: unsigned int - prepareCache序号
    • prepareCache_view: unsigned int - prepareCache视图
    • rawPrepareCache_blockHash: string - rawPrepareCache哈希
    • rawPrepareCache_height: int- rawPrepareCache高度
    • rawPrepareCache_idx: unsigned int - rawPrepareCache序号
    • rawPrepareCache_view: unsigned int - rawPrepareCache视图
    • committedPrepareCache_blockHash: string - committedPrepareCache哈希
    • committedPrepareCache_height: int- committedPrepareCache高度
    • committedPrepareCache_idx: unsigned int - committedPrepareCache序号
    • committedPrepareCache_view: unsigned int - committedPrepareCache视图
    • futureCache_blockHash: string -futureCache哈希
    • futureCache_height: int- futureCache高度
    • futureCache_idx: unsigned int - futureCache序号
    • signCache_cachedSize: unsigned int - signCache_cached大小
    • commitCache_cachedSize: unsigned int - commitCache_cached大小
    • viewChangeCache_cachedSize: unsigned int - viewChangeCache_cached大小
    • 当共识机制为Raft时(Raft详细设计参考Raft设计文档),字段如下:
    • accountType: unsigned int - 账户类型
    • allowFutureBlocks: bool - 允许未来块标志
    • cfgErr: bool - 配置错误标志
    • consensusedBlockNumber: unsigned int - 下一个共识的最新块高
    • groupId: unsigned int - 群组ID
    • highestblockHash: string - 最新块哈希
    • highestblockNumber: unsigned int - 最新区块高度
    • leaderId: string - leader的nodeId
    • leaderIdx: unsigned int - leader的序号
    • max_faulty_leader: unsigned int - 最大容错节点数
    • sealer.index: string - 节点序号为index的nodeId
    • node index: unsigned int - 节点的index
    • nodeId: string - 节点的ID
    • nodeNum: unsigned int - 节点的数
    • omitEmptyBlock: bool - 忽略空块标志位
    • protocolId: unsigned int - 协议ID号
  • 示例
  1. // Request PBFT
  2. curl -X POST --data '{"jsonrpc":"2.0","method":"getConsensusStatus","params":[1],"id":1}' http://127.0.0.1:8545 |jq
  3.  
  4. // Result
  5. {
  6. "id": 1,
  7. "jsonrpc": "2.0",
  8. "result": [
  9. {
  10. "accountType":1,
  11. "allowFutureBlocks":true,
  12. "cfgErr":false,
  13. "connectedNodes":3,
  14. "consensusedBlockNumber":4,
  15. "currentView":153,
  16. "groupId":1,
  17. "highestblockHash":"0x98e186095a88f7b1b4cd02e3c405f031950577626dab55b639e024b9f2f8788b",
  18. "highestblockNumber":3,
  19. "leaderFailed":false,
  20. "max_faulty_leader":1,
  21. "sealer.0":"29c34347a190c1ec0c4507c6eed6a5bcd4d7a8f9f54ef26da616e81185c0af11a8cea4eacb74cf6f61820292b24bc5d9e426af24beda06fbd71c217960c0dff0",
  22. "sealer.1":"41285429582cbfe6eed501806391d2825894b3696f801e945176c7eb2379a1ecf03b36b027d72f480e89d15bacd43462d87efd09fb0549e0897f850f9eca82ba",
  23. "sealer.2":"87774114e4a496c68f2482b30d221fa2f7b5278876da72f3d0a75695b81e2591c1939fc0d3fadb15cc359c997bafc9ea6fc37345346acaf40b6042b5831c97e1",
  24. "sealer.3":"d5b3a9782c6aca271c9642aea391415d8b258e3a6d92082e59cc5b813ca123745440792ae0b29f4962df568f8ad58b75fc7cea495684988e26803c9c5198f3f8",
  25. "node index":1,
  26. "nodeId":"41285429582cbfe6eed501806391d2825894b3696f801e945176c7eb2379a1ecf03b36b027d72f480e89d15bacd43462d87efd09fb0549e0897f850f9eca82ba",
  27. "nodeNum":4,
  28. "omitEmptyBlock":true,
  29. "protocolId":264,
  30. "toView":153
  31. },
  32. {
  33. "prepareCache_blockHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
  34. "prepareCache_height":-1,
  35. "prepareCache_idx":"65535",
  36. "prepareCache_view":"9223372036854775807"
  37. },
  38. {
  39. "rawPrepareCache_blockHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
  40. "rawPrepareCache_height":-1,
  41. "rawPrepareCache_idx":"65535",
  42. "rawPrepareCache_view":"9223372036854775807"
  43. },
  44. {
  45. "committedPrepareCache_blockHash":"0x2e4c63cfac7726691d1fe436ec05a7c5751dc4150d724822ff6c36a608bb39f2",
  46. "committedPrepareCache_height":3,
  47. "committedPrepareCache_idx":"2",
  48. "committedPrepareCache_view":"60"
  49. },
  50. {
  51. "futureCache_blockHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
  52. "futureCache_height":-1,
  53. "futureCache_idx":"65535",
  54. "futureCache_view":"9223372036854775807"
  55. },
  56. {
  57. "signCache_cachedSize":"0"
  58. },
  59. {
  60. "commitCache_cachedSize":"0"
  61. },
  62. {
  63. "viewChangeCache_cachedSize":"0"
  64. }
  65. ]
  66. }
  67.  
  68. // Request Raft
  69. curl -X POST --data '{"jsonrpc":"2.0","method":"getConsensusStatus","params":[1],"id":1}' http://127.0.0.1:8545 |jq
  70.  
  71. // Result
  72. {
  73. "id": 1,
  74. "jsonrpc": "2.0",
  75. "result": [
  76. {
  77. "accountType": 1,
  78. "allowFutureBlocks": true,
  79. "cfgErr": false,
  80. "consensusedBlockNumber": 1,
  81. "groupId": 1,
  82. "highestblockHash": "0x4765a126a9de8d876b87f01119208be507ec28495bef09c1e30a8ab240cf00f2",
  83. "highestblockNumber": 0,
  84. "leaderId": "d5b3a9782c6aca271c9642aea391415d8b258e3a6d92082e59cc5b813ca123745440792ae0b29f4962df568f8ad58b75fc7cea495684988e26803c9c5198f3f8",
  85. "leaderIdx": 3,
  86. "max_faulty_leader": 1,
  87. "sealer.0": "29c34347a190c1ec0c4507c6eed6a5bcd4d7a8f9f54ef26da616e81185c0af11a8cea4eacb74cf6f61820292b24bc5d9e426af24beda06fbd71c217960c0dff0",
  88. "sealer.1": "41285429582cbfe6eed501806391d2825894b3696f801e945176c7eb2379a1ecf03b36b027d72f480e89d15bacd43462d87efd09fb0549e0897f850f9eca82ba",
  89. "sealer.2": "87774114e4a496c68f2482b30d221fa2f7b5278876da72f3d0a75695b81e2591c1939fc0d3fadb15cc359c997bafc9ea6fc37345346acaf40b6042b5831c97e1",
  90. "sealer.3": "d5b3a9782c6aca271c9642aea391415d8b258e3a6d92082e59cc5b813ca123745440792ae0b29f4962df568f8ad58b75fc7cea495684988e26803c9c5198f3f8",
  91. "node index": 1,
  92. "nodeId": "41285429582cbfe6eed501806391d2825894b3696f801e945176c7eb2379a1ecf03b36b027d72f480e89d15bacd43462d87efd09fb0549e0897f850f9eca82ba",
  93. "nodeNum": 4,
  94. "omitEmptyBlock": true,
  95. "protocolId": 267
  96. }
  97. ]
  98. }