Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_coinstatsindex.py
Show All 34 Lines | def set_test_params(self): | ||||
["-coinstatsindex"] | ["-coinstatsindex"] | ||||
] | ] | ||||
def skip_test_if_missing_module(self): | def skip_test_if_missing_module(self): | ||||
self.skip_if_no_wallet() | self.skip_if_no_wallet() | ||||
def run_test(self): | def run_test(self): | ||||
self._test_coin_stats_index() | self._test_coin_stats_index() | ||||
self._test_use_index_option() | |||||
def block_sanity_check(self, block_info): | def block_sanity_check(self, block_info): | ||||
block_subsidy = 50_000_000 | block_subsidy = 50_000_000 | ||||
assert_equal( | assert_equal( | ||||
block_info['prevout_spent'] + block_subsidy, | block_info['prevout_spent'] + block_subsidy, | ||||
block_info['new_outputs_ex_coinbase'] + block_info['coinbase'] | block_info['new_outputs_ex_coinbase'] + block_info['coinbase'] | ||||
+ block_info['unspendable'] | + block_info['unspendable'] | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | def _test_coin_stats_index(self): | ||||
assert_equal(res8, res9) | assert_equal(res8, res9) | ||||
index_node.generate(1) | index_node.generate(1) | ||||
self.wait_until(lambda: not try_rpc(-32603, "Unable to read UTXO set", | self.wait_until(lambda: not try_rpc(-32603, "Unable to read UTXO set", | ||||
index_node.gettxoutsetinfo, 'muhash')) | index_node.gettxoutsetinfo, 'muhash')) | ||||
res10 = index_node.gettxoutsetinfo('muhash') | res10 = index_node.gettxoutsetinfo('muhash') | ||||
assert(res8['txouts'] < res10['txouts']) | assert(res8['txouts'] < res10['txouts']) | ||||
def _test_use_index_option(self): | |||||
self.log.info("Test use_index option for nodes running the index") | |||||
self.connect_nodes(0, 1) | |||||
self.nodes[0].waitforblockheight(110) | |||||
res = self.nodes[0].gettxoutsetinfo('muhash') | |||||
option_res = self.nodes[1].gettxoutsetinfo( | |||||
hash_type='muhash', hash_or_height=None, use_index=False) | |||||
del res['disk_size'], option_res['disk_size'] | |||||
assert_equal(res, option_res) | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
CoinStatsIndexTest().main() | CoinStatsIndexTest().main() |