diff options
author | Gregory Sanders <gsanders87@gmail.com> | 2018-06-12 16:39:29 -0400 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2018-06-15 13:34:09 +0800 |
commit | cbd2f70b75016bbadeb212c823b5c1ece95d5241 (patch) | |
tree | 0f141520289eb030e6c9b761dbab62636b4f3b20 /test | |
parent | ce8aa5491f35c2cca03ba1877cd4c926b506a961 (diff) |
expose CBlockIndex::nTx in getblock(header)
GitHub-Pull: #13451
Rebased-From: 86edf4a
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_pruning.py | 7 | ||||
-rwxr-xr-x | test/functional/rpc_blockchain.py | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 16ee5e617a..341d71c3cd 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -260,10 +260,17 @@ class PruneTest(BitcoinTestFramework): # should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000) assert_raises_rpc_error(-1, "Blockchain is too short for pruning", node.pruneblockchain, height(500)) + # Save block transaction count before pruning, assert value + block1_details = node.getblock(node.getblockhash(1)) + assert_equal(block1_details["nTx"], len(block1_details["tx"])) + # mine 6 blocks so we are at height 1001 (i.e., above PruneAfterHeight) node.generate(6) assert_equal(node.getblockchaininfo()["blocks"], 1001) + # Pruned block should still know the number of transactions + assert_equal(node.getblockheader(node.getblockhash(1))["nTx"], block1_details["nTx"]) + # negative heights should raise an exception assert_raises_rpc_error(-8, "Negative", node.pruneblockchain, -10) diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 11acff4be1..68386ca0d9 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -185,6 +185,7 @@ class BlockchainTest(BitcoinTestFramework): assert_equal(header['confirmations'], 1) assert_equal(header['previousblockhash'], secondbesthash) assert_is_hex_string(header['chainwork']) + assert_equal(header['nTx'], 1) assert_is_hash_string(header['hash']) assert_is_hash_string(header['previousblockhash']) assert_is_hash_string(header['merkleroot']) |