assert_raises_rpc_error(-1,"JSON value is not an integer as expected",self.nodes[0].getchaintxstats,'')
assert_raises_rpc_error(-8,"Invalid block count: should be between 0 and the block's height - 1",self.nodes[0].getchaintxstats,-1)
assert_raises_rpc_error(-8,"Invalid block count: should be between 0 and the block's height - 1",self.nodes[0].getchaintxstats,self.nodes[0].getblockcount())
# Test `getchaintxstats` invalid `blockhash`
assert_raises_rpc_error(-1,"JSON value is not a string as expected",self.nodes[0].getchaintxstats,blockhash=0)
assert_raises_rpc_error(-5,"Block not found",self.nodes[0].getchaintxstats,blockhash='0')
blockhash=self.nodes[0].getblockhash(200)
self.nodes[0].invalidateblock(blockhash)
assert_raises_rpc_error(-8,"Block is not in main chain",self.nodes[0].getchaintxstats,blockhash=blockhash)
self.nodes[0].reconsiderblock(blockhash)
chaintxstats=self.nodes[0].getchaintxstats(1)
# 200 txs plus genesis tx
assert_equal(chaintxstats['txcount'],201)
@ -133,8 +149,6 @@ class BlockchainTest(BitcoinTestFramework):
assert('window_interval'notinchaintxstats)
assert('txrate'notinchaintxstats)
assert_raises_rpc_error(-8,"Invalid block count: should be between 0 and the block's height - 1",self.nodes[0].getchaintxstats,201)