rpc: Return block time in getblockchaininfo #22407

pull promag wants to merge 1 commits into bitcoin:master from promag:2021-07-getblockchaininfo-time changing 3 files +8 −1
  1. promag commented at 9:46 PM on July 5, 2021: member

    Return tip time in getblockchaininfo, for some use cases this can save a call to getblock.

  2. theStack commented at 10:34 PM on July 5, 2021: member

    Concept ACK

  3. DrahtBot added the label RPC/REST/ZMQ on Jul 5, 2021
  4. naumenkogs commented at 9:47 AM on July 8, 2021: member

    ACK b17bb4c37d58ca49e877983a632bfcaa493be993. I can indeed see how this is useful.

  5. jonatack commented at 1:40 PM on July 8, 2021: member

    Concept ACK, could use a test asserting on the value, needs this change for the CI to be green:

    diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
    index 90715cae26..24dc668ea0 100755
    --- a/test/functional/rpc_blockchain.py
    +++ b/test/functional/rpc_blockchain.py
    @@ -93,6 +93,7 @@ class BlockchainTest(BitcoinTestFramework):
                 'pruned',
                 'size_on_disk',
                 'softforks',
    +            'time',
                 'verificationprogress',
                 'warnings',
    
  6. theStack commented at 2:21 PM on July 9, 2021: member

    @naumenkogs: I think you ACKed a commit not belonging to this PR?

    Happy to review and test as soon as the CI is happy (see #22407#pullrequestreview-702077013) :)

  7. promag force-pushed on Jul 11, 2021
  8. theStack approved
  9. theStack commented at 3:02 PM on July 11, 2021: member

    ACK c86e001c9731aee055fa9660154b804cdfbb12e2

    Does this need a release note?

  10. naumenkogs commented at 7:55 AM on July 12, 2021: member

    Sorry for acking the wrong hash. ACK c86e001c9731aee055fa9660154b804cdfbb12e2.

  11. 0xB10C commented at 9:04 AM on July 12, 2021: member

    ACK c86e001c9731aee055fa9660154b804cdfbb12e2

  12. Zero-1729 approved
  13. Zero-1729 commented at 4:32 PM on July 12, 2021: contributor

    tACK c86e001c9731aee055fa9660154b804cdfbb12e2.

    Tests in test/functional/rpc_blockchain.py also check out successfully. @theStack I think this change should have a release note like getnetworkinfo did when the connections_in & connections_out fields were added in v0.20.0. It could be something like:

    `getblockchaininfo` now returns a new `time` field, that provides the chain tip time. (#22407)
    
  14. kristapsk commented at 4:57 PM on July 12, 2021: contributor

    Concept ACK, but agree with @Zero-1729 that this needs release note.

  15. jarolrod commented at 10:12 PM on July 17, 2021: member

    Approach ACK c86e001c9731aee055fa9660154b804cdfbb12e2

    I would add a release note for this, the one proposed here is good.

    Additionally, I would add an assert for this as suggested here: #22407#pullrequestreview-702077013

    diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
    index 24dc668ea..f7290ff22 100755
    --- a/test/functional/rpc_blockchain.py
    +++ b/test/functional/rpc_blockchain.py
    @@ -99,6 +99,8 @@ class BlockchainTest(BitcoinTestFramework):
             ]
             res = self.nodes[0].getblockchaininfo()
     
    +        assert isinstance(res['time'], int)
    +
             # result should have these additional pruning keys if manual pruning is enabled
             assert_equal(sorted(res.keys()), sorted(['pruneheight', 'automatic_pruning'] + keys))
    
  16. rpc: Return block time in getblockchaininfo 20edf4bcf6
  17. promag force-pushed on Jul 20, 2021
  18. theStack approved
  19. theStack commented at 10:32 AM on July 20, 2021: member

    re-ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364

  20. 0xB10C approved
  21. 0xB10C commented at 10:52 AM on July 20, 2021: member

    ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364

    Now includes a release note in doc/release-notes.md and the proposed assert in the functional test.

  22. naumenkogs commented at 11:23 AM on July 20, 2021: member

    ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364

  23. kristapsk approved
  24. kristapsk commented at 12:01 PM on July 20, 2021: contributor

    ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364

  25. Zero-1729 approved
  26. Zero-1729 commented at 12:26 PM on July 20, 2021: contributor

    re-ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364

  27. MarcoFalke merged this on Jul 21, 2021
  28. MarcoFalke closed this on Jul 21, 2021

  29. promag deleted the branch on Jul 21, 2021
  30. MarcoFalke referenced this in commit 10eb000409 on Jul 21, 2021
  31. sidhujag referenced this in commit ba71ed84e3 on Jul 23, 2021
  32. MarcoFalke referenced this in commit b6c3fceed6 on Jul 30, 2021
  33. DrahtBot locked this on Aug 16, 2022

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: 2026-04-13 15:14 UTC

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