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) 2020-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.6from test_framework.test_framework import BitcoinTestFramework7from test_framework.util import assert_raises_rpc_error9class WalletCrossChain(BitcoinTestFramework):10def set_test_params(self):11self.num_nodes = 212self.setup_clean_chain = True14def skip_test_if_missing_module(self):15self.skip_if_no_wallet()17def setup_network(self):18self.add_nodes(self.num_nodes)20# Switch node 1 to any network different from regtest before starting it.21self.nodes[1].chain = 'signet'22# Disable network sync and prevent disk space warning on low resource CI23self.nodes[1].extra_args = ['-maxconnections=0', '-prune=550']24self.nodes[1].replace_in_config([('regtest=', 'signet='), ('[regtest]', '[signet]')])25self.start_nodes()27def run_test(self):28self.log.info("Creating wallets")30node0_wallet = self.nodes[0].datadir_path / 'node0_wallet'31node0_wallet_backup = self.nodes[0].datadir_path / 'node0_wallet.bak'32self.nodes[0].createwallet(node0_wallet)33self.nodes[0].backupwallet(node0_wallet_backup)34self.nodes[0].unloadwallet(node0_wallet)35node1_wallet = self.nodes[1].datadir_path / 'node1_wallet'36node1_wallet_backup = self.nodes[0].datadir_path / 'node1_wallet.bak'37self.nodes[1].createwallet(node1_wallet)38self.nodes[1].backupwallet(node1_wallet_backup)39self.nodes[1].unloadwallet(node1_wallet)41self.log.info("Loading/restoring wallets into nodes with a different genesis block")43assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[0].loadwallet, node1_wallet)44assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[1].loadwallet, node0_wallet)45assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[0].restorewallet, 'w', node1_wallet_backup)46assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[1].restorewallet, 'w', node0_wallet_backup)49if __name__ == '__main__':50WalletCrossChain(__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.