dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Help messages for RPC calls need to be updated #963

Closed cornelius closed 5 years ago

cornelius commented 5 years ago

Describe the bug

The help texts for the RPC messages don't reflect recent changes of adding additional merkle roots and removing the nonce.

To Reproduce Steps to reproduce the behavior:

  1. run unit-e-cli getblockheader, the output contains witnessmerkleroot, finalizercommitsmerkleroot
  2. run unit-e-cli help getblockheader, the output does not contain these fields, but it does contain the nonce field
  3. Same for unit-e-cli getblock

Expected behavior

The Result section in the help texts for RPC commands should contain the same fields as the command actually returns as result.

spiritlcx commented 5 years ago

Hi, I have reproduced the behavior and will fix it soon.

spiritlcx@spiritlcx:~/.unit-e/testnet$ unit-e-cli getblockheader 95ba58758fa90dd1fefe2a2780358befd2b67160f8a71ef01836fb09ac87f97d true { "hash": "95ba58758fa90dd1fefe2a2780358befd2b67160f8a71ef01836fb09ac87f97d", "confirmations": 704, "height": 107466, "version": 1, "versionHex": "00000001", "merkleroot": "7941bf26a78db6158f3c706124a74be4d14051102ce3fc4d6cddfdfcc2098263", "witnessmerkleroot": "fc893e2c314b0805712f12693af5d4e359ff00ee3d9db77c3ff29978307f75fd", "finalizercommitsmerkleroot": "0000000000000000000000000000000000000000000000000000000000000000", "time": 1556377868, "mediantime": 1556377824, "bits": "1a04387a", "difficulty": 3975006.871099992, "chainwork": "00000000000000000000000000000000000000000000007c2de410a2108adbe0", "nTx": 1, "previousblockhash": "e439b94b07dc564d13e1ba3221f7b74576a7f29bf663315163bfe5315255956c", "nextblockhash": "3f0ed755e340627489abf6395aa635d4539f7ac22fb45b0f44a719e04d2dc08f" }

Result (for verbose = true): { "hash" : "hash", (string) the block hash (same as provided) "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain "height" : n, (numeric) The block height or index "version" : n, (numeric) The block version "versionHex" : "00000000", (string) The block version formatted in hexadecimal "merkleroot" : "xxxx", (string) The merkle root "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) "mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT) "nonce" : n, (numeric) The nonce "bits" : "1d00ffff", (string) The bits "difficulty" : x.xxx, (numeric) The difficulty "chainwork" : "0000...1f3" (string) Expected number of hashes required to produce the current chain (in hex) "nTx" : n, (numeric) The number of transactions in the block. "previousblockhash" : "hash", (string) The hash of the previous block "nextblockhash" : "hash", (string) The hash of the next block }

spiritlcx commented 5 years ago

By the way, I'm a distributed relational database developer in Alibaba with 2 years working experience and with great interest in blockchain. I'm trying to find an open source project to take part in and find unit-e is really a good choice. Hoping to make some contributions.

cornelius commented 5 years ago

@spiritlcx Cool, welcome. Feel free to create a pull request when you have a fix. Contributions are appreciated 😄