aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-10-09 16:53:12 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-10-09 17:04:18 +0200
commit3a93270c55876cc88e1a3e2921e582acc6db318e (patch)
tree456af0e53fe56f234c3f447c9fc6764582985df2 /test
parentda0478e6e5d93d13178d098209f4397730b94065 (diff)
parentb7dfc6c4b89b62f9bb79ea009ee103a6299ac005 (diff)
downloadbitcoin-3a93270c55876cc88e1a3e2921e582acc6db318e.tar.xz
Merge #11367: [rpc] getblockchaininfo: add size_on_disk, prune_target_size
b7dfc6c [rpc] getblockchaininfo: add size_on_disk, prune_target_size, automatic_pruning (Daniel Edgecumbe) Pull request description: Tree-SHA512: c255c27d6c922434d203ffdefda0dd3dddbd765b6a9cce5f80f5af5cb0b1c11c8aff6f4d00e96a326701d0bc81aace2f216fd1985675aa979f76c16f564a6cf6
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/blockchain.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/test/functional/blockchain.py b/test/functional/blockchain.py
index 5bd3bc8f83..de222584b8 100755
--- a/test/functional/blockchain.py
+++ b/test/functional/blockchain.py
@@ -24,6 +24,8 @@ import subprocess
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
+ assert_greater_than,
+ assert_greater_than_or_equal,
assert_raises,
assert_raises_jsonrpc,
assert_is_hex_string,
@@ -58,21 +60,43 @@ class BlockchainTest(BitcoinTestFramework):
'headers',
'mediantime',
'pruned',
+ 'size_on_disk',
'softforks',
'verificationprogress',
'warnings',
]
res = self.nodes[0].getblockchaininfo()
- # result should have pruneheight and default keys if pruning is enabled
- assert_equal(sorted(res.keys()), sorted(['pruneheight'] + keys))
+
+ # result should have these additional pruning keys if manual pruning is enabled
+ assert_equal(sorted(res.keys()), sorted(['pruneheight', 'automatic_pruning'] + keys))
+
+ # size_on_disk should be > 0
+ assert_greater_than(res['size_on_disk'], 0)
+
# pruneheight should be greater or equal to 0
- assert res['pruneheight'] >= 0
+ assert_greater_than_or_equal(res['pruneheight'], 0)
+
+ # check other pruning fields given that prune=1
+ assert res['pruned']
+ assert not res['automatic_pruning']
self.restart_node(0, ['-stopatheight=207'])
res = self.nodes[0].getblockchaininfo()
# should have exact keys
assert_equal(sorted(res.keys()), keys)
+ self.restart_node(0, ['-stopatheight=207', '-prune=550'])
+ res = self.nodes[0].getblockchaininfo()
+ # result should have these additional pruning keys if prune=550
+ assert_equal(sorted(res.keys()), sorted(['pruneheight', 'automatic_pruning', 'prune_target_size'] + keys))
+
+ # check related fields
+ assert res['pruned']
+ assert_equal(res['pruneheight'], 0)
+ assert res['automatic_pruning']
+ assert_equal(res['prune_target_size'], 576716800)
+ assert_greater_than(res['size_on_disk'], 0)
+
def _test_getchaintxstats(self):
chaintxstats = self.nodes[0].getchaintxstats(1)
# 200 txs plus genesis tx