Skip to content

Commit cc36b5e

Browse files
committed
[test] Add test for getchaintxstats
1 parent 098b01d commit cc36b5e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/blockchain.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- getbestblockhash
1111
- getblockhash
1212
- getblockheader
13+
- getchaintxstats
1314
- getnetworkhashps
1415
- verifychain
1516
@@ -35,12 +36,21 @@ def __init__(self):
3536
self.num_nodes = 1
3637

3738
def run_test(self):
39+
self._test_getchaintxstats()
3840
self._test_gettxoutsetinfo()
3941
self._test_getblockheader()
4042
self._test_getdifficulty()
4143
self._test_getnetworkhashps()
4244
self.nodes[0].verifychain(4, 0)
4345

46+
def _test_getchaintxstats(self):
47+
chaintxstats = self.nodes[0].getchaintxstats(1)
48+
# 200 txs plus genesis tx
49+
assert_equal(chaintxstats['txcount'], 201)
50+
# tx rate should be 1 per 10 minutes, or 1/600
51+
# we have to round because of binary math
52+
assert_equal(round(chaintxstats['txrate'] * 600, 10), Decimal(1))
53+
4454
def _test_gettxoutsetinfo(self):
4555
node = self.nodes[0]
4656
res = node.gettxoutsetinfo()

0 commit comments

Comments
 (0)