rpc: Always throw in getblockstats if -txindex is required

Previously blocks with only the coinbase transaction didn't cause
the RPC error even if the requested stats required -txindex and
it wasn't enabled.
This commit is contained in:
João Barbosa
2018-10-19 15:24:08 +01:00
parent d387507aec
commit 3be209d103
2 changed files with 6 additions and 4 deletions

View File

@ -169,6 +169,8 @@ class GetblockstatsTest(BitcoinTestFramework):
assert_raises_rpc_error(-8, 'Invalid selected statistic aaa%s' % inv_sel_stat,
self.nodes[0].getblockstats, hash_or_height=1, stats=['minfee' , 'aaa%s' % inv_sel_stat])
assert_raises_rpc_error(-8, 'One or more of the selected stats requires -txindex enabled',
self.nodes[1].getblockstats, hash_or_height=1)
assert_raises_rpc_error(-8, 'One or more of the selected stats requires -txindex enabled',
self.nodes[1].getblockstats, hash_or_height=self.start_height + self.max_stat_pos)