Merge bitcoin/bitcoin#22407: rpc: Return block time in getblockchaininfo

20edf4bcf6 rpc: Return block time in getblockchaininfo (João Barbosa)

Pull request description:

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

ACKs for top commit:
  naumenkogs:
    ACK 20edf4bcf6
  theStack:
    re-ACK 20edf4bcf6
  0xB10C:
    ACK 20edf4bcf6
  kristapsk:
    ACK 20edf4bcf6
  Zero-1729:
    re-ACK 20edf4bcf6

Tree-SHA512: 29a920cfff1ef53e0af601c3f93f8f9171f3be47fc84b0fa293cb865b824976e8c1510b17b27d17daf0b8e658dd77d9dc388373395f0919fc4a23cd5019642d5
This commit is contained in:
MarcoFalke
2021-07-21 09:47:31 +02:00
3 changed files with 8 additions and 1 deletions

View File

@@ -93,11 +93,14 @@ class BlockchainTest(BitcoinTestFramework):
'pruned',
'size_on_disk',
'softforks',
'time',
'verificationprogress',
'warnings',
]
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))