Skip to content

Commit

Permalink
[test] Add test for getchaintxstats
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmysong committed Jun 3, 2017
1 parent 098b01d commit cc36b5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/functional/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- getbestblockhash
- getblockhash
- getblockheader
- getchaintxstats
- getnetworkhashps
- verifychain
Expand All @@ -35,12 +36,21 @@ def __init__(self):
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()
Expand Down

0 comments on commit cc36b5e

Please sign in to comment.