aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJimmy Song <jaejoon@gmail.com>2017-06-02 21:48:32 -0700
committerJimmy Song <jaejoon@gmail.com>2017-06-02 21:48:32 -0700
commitcc36b5e3d7ae9eebcc0768b6707e8928e3cd69aa (patch)
tree638c4e74d5bce4c4e462760481a9495ceb713bab /test
parent098b01dc58ff555c473ae58c92c34b03a77eda5f (diff)
downloadbitcoin-cc36b5e3d7ae9eebcc0768b6707e8928e3cd69aa.tar.xz
[test] Add test for getchaintxstats
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/blockchain.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/blockchain.py b/test/functional/blockchain.py
index 4bfd3ee677..5ada3e629e 100755
--- a/test/functional/blockchain.py
+++ b/test/functional/blockchain.py
@@ -10,6 +10,7 @@ Test the following RPCs:
- getbestblockhash
- getblockhash
- getblockheader
+ - getchaintxstats
- getnetworkhashps
- verifychain
@@ -35,12 +36,21 @@ class BlockchainTest(BitcoinTestFramework):
self.num_nodes = 1
def run_test(self):
+ self._test_getchaintxstats()
self._test_gettxoutsetinfo()
self._test_getblockheader()
self._test_getdifficulty()
self._test_getnetworkhashps()
self.nodes[0].verifychain(4, 0)
+ def _test_getchaintxstats(self):
+ chaintxstats = self.nodes[0].getchaintxstats(1)
+ # 200 txs plus genesis tx
+ assert_equal(chaintxstats['txcount'], 201)
+ # tx rate should be 1 per 10 minutes, or 1/600
+ # we have to round because of binary math
+ assert_equal(round(chaintxstats['txrate'] * 600, 10), Decimal(1))
+
def _test_gettxoutsetinfo(self):
node = self.nodes[0]
res = node.gettxoutsetinfo()