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.
751assert_equal(snapshot['blocks'], SNAPSHOT_BASE_HEIGHT)752assert_equal(snapshot['snapshot_blockhash'], dump_output['base_hash'])753assert_equal(snapshot['validated'], False)755self.log.info("Check that loading the snapshot again will fail because there is already an active snapshot.")756msg = "Unable to load UTXO snapshot: Can't activate a snapshot-based chainstate more than once"757assert_raises_rpc_error(-32603, msg, n2.loadtxoutset, dump_output['path'])759# Upon restart, the node must stay in 'limited' mode until the background760# chain sync completes.761self.restart_node(2, extra_args=self.extra_args[2])762self.assert_only_network_limited_service(n2)764self.connect_nodes(0, 2)765self.wait_until(lambda: n2.getchainstates()['chainstates'][-1]['blocks'] == FINAL_HEIGHT)766self.sync_blocks(nodes=(n0, n2))768self.log.info("Ensuring background validation completes")769self.wait_until(lambda: len(n2.getchainstates()['chainstates']) == 1)771# Once background chain sync completes, the full node must start offering historical blocks again.772self.wait_until(lambda: {'NETWORK', 'NETWORK_LIMITED'}.issubset(n2.getnetworkinfo()['localservicesnames']))774completed_idx_state = {775'basic block filter index': COMPLETE_IDX,776'coinstatsindex': COMPLETE_IDX,777'txindex': COMPLETE_IDX,778}779self.wait_until(lambda: n2.getindexinfo() == completed_idx_state)781for i in (0, 2):782n = self.nodes[i]783self.log.info(f"Restarting node {i} to ensure (Check|Load)BlockIndex passes")784with self.assert_disk_cleanup(n, i == 2):785self.restart_node(i, extra_args=self.extra_args[i])787assert_equal(n.getblockchaininfo()["blocks"], FINAL_HEIGHT)789chainstate, = n.getchainstates()['chainstates']790assert_equal(chainstate['blocks'], FINAL_HEIGHT)792if i != 0:793# Ensure indexes have synced for the assumeutxo node794self.wait_until(lambda: n.getindexinfo() == completed_idx_state)796self.log.info("Test -reindex-chainstate of an assumeutxo-synced node")797self.restart_node(2, extra_args=[798'-reindex-chainstate=1', *self.extra_args[2]])799assert_equal(n2.getblockchaininfo()["blocks"], FINAL_HEIGHT)800self.wait_until(lambda: n2.getblockcount() == FINAL_HEIGHT)802self.log.info("Test -reindex of an assumeutxo-synced node")803self.restart_node(2, extra_args=['-reindex=1', *self.extra_args[2]])804self.connect_nodes(0, 2)805self.wait_until(lambda: n2.getblockcount() == FINAL_HEIGHT)807self.test_snapshot_in_a_divergent_chain(dump_output['path'])809# The following test cleans node2 and node3 chain directories.810self.test_sync_from_assumeutxo_node(snapshot=dump_output)812self.test_sync_to_most_work_chain_after_background_validation()814@dataclass815class Block:816hash: str817tx: int818chain_tx: int820if __name__ == '__main__':821AssumeutxoTest(__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.