Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#!/usr/bin/env python32# Copyright (c) 2025-present The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or http://www.opensource.org/licenses/mit-license.php.5"""Test coinstatsindex across node versions.7This test may be removed some time after v29 has reached end of life.8"""10import shutil12from test_framework.test_framework import BitcoinTestFramework13from test_framework.util import assert_equal16class CoinStatsIndexTest(BitcoinTestFramework):17def set_test_params(self):18self.num_nodes = 219self.extra_args = [["-coinstatsindex"],["-coinstatsindex"]]21def skip_test_if_missing_module(self):22self.skip_if_no_previous_releases()24def setup_nodes(self):25self.add_nodes(26self.num_nodes,27extra_args=self.extra_args,28versions=[29None,30280200,31],32)33self.start_nodes()35def run_test(self):36self._test_coin_stats_index_compatibility()38def _test_coin_stats_index_compatibility(self):39node = self.nodes[0]40legacy_node = self.nodes[1]41for n in self.nodes:42self.wait_until(lambda: n.getindexinfo()['coinstatsindex']['synced'] is True)44self.log.info("Test that gettxoutsetinfo() output is consistent between the different index versions")45res0 = node.gettxoutsetinfo('muhash')46res1 = legacy_node.gettxoutsetinfo('muhash')47assert_equal(res1, res0)49self.log.info("Test that gettxoutsetinfo() output is consistent for the new index running on a datadir with the old version")50self.stop_nodes()51self.cleanup_folder(node.chain_path / "indexes" / "coinstatsindex")52shutil.copytree(legacy_node.chain_path / "indexes" / "coinstats", node.chain_path / "indexes" / "coinstats")53old_version_path = node.chain_path / "indexes" / "coinstats"54msg = f'[warning] Old version of coinstatsindex found at {old_version_path}. This folder can be safely deleted unless you plan to downgrade your node to version 29 or lower.'55with node.assert_debug_log(expected_msgs=[msg]):56self.start_node(0, ['-coinstatsindex'])57self.wait_until(lambda: node.getindexinfo()['coinstatsindex']['synced'] is True)58res2 = node.gettxoutsetinfo('muhash')59assert_equal(res2, res0)62if __name__ == '__main__':63CoinStatsIndexTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.