Add getchaintxstats RPC #9733

pull sipa wants to merge 1 commits into bitcoin:master from sipa:chaintxstats changing 2 files +67 −0
  1. sipa commented at 1:26 am on February 10, 2017: member
    Not intended for 0.14, but may be used to compute the new chainTxData constants in releases.
  2. sipa commented at 1:30 am on February 10, 2017: member
    Alternative: don’t allow specifying the window size, and include the output in getblockchaininfo.
  3. in src/rpc/blockchain.cpp: in 53d4292763 outdated
    1427+            "  \"time\": xxxxx,        (numeric) The timestamp for the statistics in UNIX format.\n"
    1428+            "  \"txcount\": xxxxx,     (numeric) The total number of transactions in the chain up to that point.\n"
    1429+            "  \"txrate\": x.xx,       (numeric) The average rate of transactions per second in the window.\n"
    1430+            "}\n"
    1431+            "\nExamples:\n"
    1432+            + HelpExampleCli("gettxratestats", "")
    


    paveljanik commented at 7:09 am on February 10, 2017:
    getchaintxstats vs gettxratestats
  4. paveljanik commented at 7:26 am on February 10, 2017: contributor
    I prefer having it separate from getblockchaininfo because it brings more flexibility - ability to query past data etc. On the other hand, adding current txrate and txcount to getblockchaininfo: why not :-)
  5. fanquake added the label RPC/REST/ZMQ on Feb 10, 2017
  6. laanwj commented at 8:44 am on February 10, 2017: member

    Concept ACK. Though I wonder if this shouldn’t be an external script, if it’s only used for computing some statistics before releases.

    On the other hand, adding current txrate and txcount to getblockchaininfo: why not :-)

    Well we shouldn’t add anything that is non-trivial to compute to getblockchaininfo. I think restricting that call to return state information that is up-to-date and used by the client anyway makes sense. Otherwise it becomes slower and slower as more things are added, like what happened to getinfo. So a separate call is fine with me.

  7. sipa commented at 9:32 am on April 5, 2017: member

    Though I wonder if this shouldn’t be an external script, if it’s only used for computing some statistics before releases.

    I don’t think it’s unreasonable to have a built-in function to compute the transaction rate.

  8. jnewbery commented at 8:06 pm on April 5, 2017: member

    I don’t think it’s unreasonable to have a built-in function to compute the transaction rate.

    What’s the use case for this, other than computing the chainTxData constants?

  9. sipa commented at 8:03 am on April 6, 2017: member

    What’s the use case for this, other than computing the chainTxData constants?

    Not really a use case, except that’s it’s generally useful information that someone may be interested in.

  10. in src/rpc/blockchain.cpp:1436 in 53d4292763 outdated
    1431+            "\nExamples:\n"
    1432+            + HelpExampleCli("gettxratestats", "")
    1433+            + HelpExampleRpc("gettxratestats", "2016")
    1434+        );
    1435+
    1436+    CBlockIndex* pindex;
    


    TheBlueMatt commented at 9:14 pm on April 17, 2017:
    nit: const CBlockIndex
  11. TheBlueMatt commented at 9:21 pm on April 17, 2017: member
    utACK +/- the two nits
  12. jtimon commented at 7:29 pm on April 24, 2017: contributor
    utACK 53d4292763b2896c50d1e9f3140796f563dcd350 Although for plotting things an interface like initialBlockHeight, endBlockHeight feel more natural than the distance and the hash of the block. It seems there’s no functionality loss since the block hash cannot be used to select a chain that is not part of the active chain anyway.
  13. laanwj commented at 4:56 pm on May 2, 2017: member
    Can be merged if the small nits by @TheBlueMatt and @paveljanik are fixed
  14. Add getchaintxstats RPC 484d40e3f1
  15. sipa force-pushed on May 3, 2017
  16. sipa commented at 4:27 am on May 3, 2017: member
    @laanwj Done.
  17. in src/rpc/blockchain.cpp:1419 in 484d40e3f1
    1412@@ -1413,10 +1413,76 @@ UniValue reconsiderblock(const JSONRPCRequest& request)
    1413     return NullUniValue;
    1414 }
    1415 
    1416+UniValue getchaintxstats(const JSONRPCRequest& request)
    1417+{
    1418+    if (request.fHelp || request.params.size() > 2)
    1419+        throw runtime_error(
    


    laanwj commented at 5:58 am on May 3, 2017:
    looks like travis complains now: the using namespace was removed, so this should be std::runtime_error, will fix this up before merging
  18. laanwj referenced this in commit d4732f3232 on May 3, 2017
  19. laanwj commented at 6:17 am on May 3, 2017: member
    Merged via d4732f3
  20. laanwj closed this on May 3, 2017

  21. PastaPastaPasta referenced this in commit 843ffa4eb5 on Jun 10, 2019
  22. PastaPastaPasta referenced this in commit 1aafd9b208 on Jun 10, 2019
  23. PastaPastaPasta referenced this in commit 3b6b65b645 on Jun 10, 2019
  24. PastaPastaPasta referenced this in commit d017dd175d on Jun 11, 2019
  25. PastaPastaPasta referenced this in commit 0b5025bbd0 on Jun 11, 2019
  26. PastaPastaPasta referenced this in commit 85767af6c3 on Jun 15, 2019
  27. PastaPastaPasta referenced this in commit 83875836f6 on Jun 19, 2019
  28. PastaPastaPasta referenced this in commit 11286413ec on Jun 19, 2019
  29. PastaPastaPasta referenced this in commit b25c3cf54e on Jun 19, 2019
  30. PastaPastaPasta referenced this in commit edf02b0791 on Jun 19, 2019
  31. PastaPastaPasta referenced this in commit fceabc7306 on Jun 19, 2019
  32. PastaPastaPasta referenced this in commit 6f741e5583 on Jun 19, 2019
  33. PastaPastaPasta referenced this in commit 44446b9870 on Jun 19, 2019
  34. PastaPastaPasta referenced this in commit 1c8452b6d5 on Jun 20, 2019
  35. barrystyle referenced this in commit 6f0c4390f4 on Jan 22, 2020
  36. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me