getConsensusStatus

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

参数

  • groupID: unsigned int - 群组ID

返回值

  • object - 共识状态信息。
  • 当共识机制为PBFT时(PBFT详细设计参考PBFT设计文档),字段如下:
    • accountType: unsigned int - 节点类型,0表示观察节点,1表示共识节点
    • allowFutureBlocks: bool - 允许未来块标志,当前为true
    • cfgErr: bool - 表明节点是否出错,true表示节点已经异常
    • connectedNodes: unsigned int - 连接的节点数
    • consensusedBlockNumber: unsigned int - 当前正在共识的区块高度
    • currentView: unsigned int - 当前视图
    • groupId: unsigned int - 群组ID
    • highestblockHash: string - 最新块哈希
    • highestblockNumber: unsigned int - 最新区块高度
    • leaderFailed: bool - leader失败标志,若为false,节点可能正在处理超时
    • max_faulty_leader: unsigned int - 最大容错节点数
    • nodeNum: unsigned int - 节点的数
    • node_index: unsigned int - 共识节点索引
    • nodeId: string - 节点的ID
    • omitEmptyBlock: bool - 忽略空块标志位,为true
    • protocolId: unsigned int - 协议ID号
    • sealer.index: string - 指定索引index对应的共识节点nodeID
    • toView: unsigned int - 目前到达的view值
    • 与本节点相连的所有共识节点nodeID和视图view信息
  • 当共识机制为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. // Result
  4. {
  5. "id": 1,
  6. "jsonrpc": "2.0",
  7. "result": [
  8. {
  9. "accountType": 1,
  10. "allowFutureBlocks": true,
  11. "cfgErr": false,
  12. "connectedNodes": 3,
  13. "consensusedBlockNumber": 38207,
  14. "currentView": 54477,
  15. "groupId": 1,
  16. "highestblockHash": "0x19a16e8833e671aa11431de589c866a6442ca6c8548ba40a44f50889cd785069",
  17. "highestblockNumber": 38206,
  18. "leaderFailed": false,
  19. "max_faulty_leader": 1,
  20. "nodeId": "f72648fe165da17a889bece08ca0e57862cb979c4e3661d6a77bcc2de85cb766af5d299fec8a4337eedd142dca026abc2def632f6e456f80230902f93e2bea13",
  21. "nodeNum": 4,
  22. "node_index": 3,
  23. "omitEmptyBlock": true,
  24. "protocolId": 65544,
  25. "sealer.0": "6a99f357ecf8a001e03b68aba66f68398ee08f3ce0f0147e777ec77995369aac470b8c9f0f85f91ebb58a98475764b7ca1be8e37637dd6cb80b3355749636a3d",
  26. "sealer.1": "8a453f1328c80b908b2d02ba25adca6341b16b16846d84f903c4f4912728c6aae1050ce4f24cd9c13e010ce922d3393b846f6f5c42f6af59c65a814de733afe4",
  27. "sealer.2": "ed483837e73ee1b56073b178f5ac0896fa328fc0ed418ae3e268d9e9109721421ec48d68f28d6525642868b40dd26555c9148dbb8f4334ca071115925132889c",
  28. "sealer.3": "f72648fe165da17a889bece08ca0e57862cb979c4e3661d6a77bcc2de85cb766af5d299fec8a4337eedd142dca026abc2def632f6e456f80230902f93e2bea13",
  29. "toView": 54477
  30. },
  31. [
  32. {
  33. "nodeId": "6a99f357ecf8a001e03b68aba66f68398ee08f3ce0f0147e777ec77995369aac470b8c9f0f85f91ebb58a98475764b7ca1be8e37637dd6cb80b3355749636a3d",
  34. "view": 54474
  35. },
  36. {
  37. "nodeId": "8a453f1328c80b908b2d02ba25adca6341b16b16846d84f903c4f4912728c6aae1050ce4f24cd9c13e010ce922d3393b846f6f5c42f6af59c65a814de733afe4",
  38. "view": 54475
  39. },
  40. {
  41. "nodeId": "ed483837e73ee1b56073b178f5ac0896fa328fc0ed418ae3e268d9e9109721421ec48d68f28d6525642868b40dd26555c9148dbb8f4334ca071115925132889c",
  42. "view": 54476
  43. },
  44. {
  45. "nodeId": "f72648fe165da17a889bece08ca0e57862cb979c4e3661d6a77bcc2de85cb766af5d299fec8a4337eedd142dca026abc2def632f6e456f80230902f93e2bea13",
  46. "view": 54477
  47. }
  48. ]
  49. ]
  50. }
  51. // Request Raft
  52. curl -X POST --data '{"jsonrpc":"2.0","method":"getConsensusStatus","params":[1],"id":1}' http://127.0.0.1:8545 |jq
  53. // Result
  54. {
  55. "id": 1,
  56. "jsonrpc": "2.0",
  57. "result": [
  58. {
  59. "accountType": 1,
  60. "allowFutureBlocks": true,
  61. "cfgErr": false,
  62. "consensusedBlockNumber": 1,
  63. "groupId": 1,
  64. "highestblockHash": "0x4765a126a9de8d876b87f01119208be507ec28495bef09c1e30a8ab240cf00f2",
  65. "highestblockNumber": 0,
  66. "leaderId": "d5b3a9782c6aca271c9642aea391415d8b258e3a6d92082e59cc5b813ca123745440792ae0b29f4962df568f8ad58b75fc7cea495684988e26803c9c5198f3f8",
  67. "leaderIdx": 3,
  68. "max_faulty_leader": 1,
  69. "sealer.0": "29c34347a190c1ec0c4507c6eed6a5bcd4d7a8f9f54ef26da616e81185c0af11a8cea4eacb74cf6f61820292b24bc5d9e426af24beda06fbd71c217960c0dff0",
  70. "sealer.1": "41285429582cbfe6eed501806391d2825894b3696f801e945176c7eb2379a1ecf03b36b027d72f480e89d15bacd43462d87efd09fb0549e0897f850f9eca82ba",
  71. "sealer.2": "87774114e4a496c68f2482b30d221fa2f7b5278876da72f3d0a75695b81e2591c1939fc0d3fadb15cc359c997bafc9ea6fc37345346acaf40b6042b5831c97e1",
  72. "sealer.3": "d5b3a9782c6aca271c9642aea391415d8b258e3a6d92082e59cc5b813ca123745440792ae0b29f4962df568f8ad58b75fc7cea495684988e26803c9c5198f3f8",
  73. "node index": 1,
  74. "nodeId": "41285429582cbfe6eed501806391d2825894b3696f801e945176c7eb2379a1ecf03b36b027d72f480e89d15bacd43462d87efd09fb0549e0897f850f9eca82ba",
  75. "nodeNum": 4,
  76. "omitEmptyBlock": true,
  77. "protocolId": 267
  78. }
  79. ]
  80. }