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.
251'p2p_invalid_locator.py',252'p2p_invalid_block.py --v1transport',253'p2p_invalid_block.py --v2transport',254'p2p_invalid_tx.py --v1transport',255'p2p_invalid_tx.py --v2transport',256'p2p_v2_transport.py',257'p2p_v2_encrypted.py',258'p2p_v2_misbehaving.py',259'example_test.py',260'mempool_truc.py',261'wallet_multisig_descriptor_psbt.py',262'wallet_miniscript_decaying_multisig_descriptor_psbt.py',263'wallet_txn_doublespend.py',264'wallet_backwards_compatibility.py',265'wallet_txn_clone.py --mineblock',266'feature_notifications.py',267'rpc_getblockfilter.py',268'rpc_getblockfrompeer.py',269'rpc_invalidateblock.py',270'feature_utxo_set_hash.py',271'feature_rbf.py',272'mempool_packages.py',273'mempool_package_limits.py',274'mempool_package_rbf.py',275'tool_utxo_to_sqlite.py',276'feature_versionbits_warning.py',277'feature_blocksxor.py',278'rpc_preciousblock.py',279'wallet_importprunedfunds.py',280'p2p_leak_tx.py --v1transport',281'p2p_leak_tx.py --v2transport',282'p2p_tx_relay_rate_limit.py',283'p2p_eviction.py',284'p2p_outbound_eviction.py',285'p2p_ibd_stalling.py --v1transport',286'p2p_ibd_stalling.py --v2transport',287'p2p_net_deadlock.py --v1transport',288'p2p_net_deadlock.py --v2transport',289'wallet_signmessagewithaddress.py',290'rpc_signmessagewithprivkey.py',291'rpc_generate.py',292'wallet_balance.py',293'p2p_initial_headers_sync.py',294'feature_nulldummy.py',295'mempool_accept.py',296'p2p_addr_selfannouncement.py',297'mempool_expiry.py',298'wallet_importdescriptors.py',299'wallet_crosschain.py',300'mining_basic.py',301'mining_mainnet.py',302'feature_signet.py',303'p2p_mutated_blocks.py',304'rpc_named_arguments.py',305'feature_startupnotify.py',306'wallet_simulaterawtx.py',307'wallet_listsinceblock.py',308'wallet_listdescriptors.py',309'p2p_leak.py',310'p2p_bip434_feature.py',311'p2p_bip434_feature.py --v2transport',312'wallet_encryption.py',313'feature_dersig.py',314'feature_reindex_init.py',315'feature_cltv.py',316'rpc_uptime.py',317'feature_discover.py',318'wallet_resendwallettransactions.py',319'wallet_fallbackfee.py',320'rpc_dumptxoutset.py',321'feature_minchainwork.py',322'rpc_estimatefee.py',323'p2p_private_broadcast.py',324'p2p_private_broadcast_completion.py',325'p2p_private_broadcast_cap.py',326'rpc_getblockstats.py',327'feature_port.py',328'feature_bind_port_externalip.py',329'wallet_create_tx.py',330'wallet_send.py',331'wallet_sendall.py',332'wallet_sendmany.py',333'wallet_spend_unconfirmed.py',334'wallet_rescan_unconfirmed.py',335'p2p_fingerprint.py',336'feature_uacomment.py',337'feature_init.py',338'wallet_coinbase_category.py',339'feature_filelock.py',340'feature_loadblock.py',341'wallet_assumeutxo.py',342'p2p_add_connections.py',343'feature_bind_port_discover.py',344'p2p_unrequested_blocks.py',345'p2p_message_capture.py',346'feature_includeconf.py',347'feature_addrman.py',348'feature_asmap.py',349'feature_chain_tiebreaks.py',350'feature_fastprune.py',351'feature_framework_miniwallet.py',352'mempool_unbroadcast.py',353'mempool_compatibility.py',354'mempool_accept_wtxid.py',355'mempool_dust.py',356'mempool_sigoplimit.py',357'rpc_deriveaddresses.py',358'rpc_deriveaddresses.py --usecli',359'p2p_ping.py',360'p2p_tx_privacy.py',361'rpc_getdescriptoractivity.py',362'rpc_scanblocks.py',363'tool_bitcoin.py',364'p2p_sendtxrcncl.py',365'p2p_connection_limits.py',366'rpc_scantxoutset.py',367'feature_torcontrol.py',368'feature_unsupported_utxo_db.py',369'mempool_cluster.py',370'feature_logging.py',371'interface_ipc.py',372'interface_ipc_mining.py',373'interface_gui.py',374'feature_anchors.py',375'mempool_datacarrier.py',376'feature_coinstatsindex.py',377'feature_coinstatsindex_compatibility.py',378'wallet_orphanedreward.py',379'wallet_musig.py',380'wallet_timelock.py',381'p2p_permissions.py',382'feature_blocksdir.py',383'wallet_startup.py',384'p2p_private_broadcast_retry_v1.py',385'feature_remove_pruned_files_on_startup.py',386'feature_prune_stale_fork.py',387'p2p_i2p_ports.py',388'p2p_i2p_sessions.py',389'feature_presegwit_node_upgrade.py',390'feature_settings.py',391'rpc_getdescriptorinfo.py',392'rpc_gettxspendingprevout.py',393'rpc_help.py',394'feature_framework_testshell.py',395'tool_rpcauth.py',396'p2p_handshake.py',397'p2p_handshake.py --v2transport',398'interface_ipc_cli.py',399'feature_dirsymlinks.py',400'feature_help.py',401'feature_framework_startup_failures.py',402'feature_shutdown.py',403'wallet_migration.py',404'p2p_ibd_txrelay.py',405'p2p_seednode.py',406'rpc_openrpc.py',407'wallet_ancient_migration.py',408# Don't append tests at the end to avoid merge conflicts409# Put them in a random line within the section that fits their approximate run-time410]412# Place EXTENDED_SCRIPTS first since it has the 3 longest running tests413ALL_SCRIPTS = EXTENDED_SCRIPTS + BASE_SCRIPTS415NON_SCRIPTS = [416# These are python files that live in the functional tests directory, but are not test scripts.417"combine_logs.py",418"create_cache.py",419"test_runner.py",420]422def main():423# Parse arguments and pass through unrecognised args424parser = argparse.ArgumentParser(add_help=False,425usage='%(prog)s [test_runner.py options] [script options] [scripts]',426description=__doc__,427epilog='''428Help text and arguments for individual test script:''',429formatter_class=argparse.RawTextHelpFormatter)430parser.add_argument('--ansi', action='store_true', default=sys.stdout.isatty(), help="Use ANSI colors and dots in output (enabled by default when standard output is a TTY)")431parser.add_argument('--combinedlogslen', '-c', type=int, default=0, metavar='n', help='On failure, print a log (of length n lines) to the console, combined from the test framework and all test nodes.')432parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')433parser.add_argument('--exclude', '-x', action='append', help='specify a script to exclude. Can be specified multiple times. The .py extension is optional.')434parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')435parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')436parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')437parser.add_argument('--quiet', '-q', action='store_true', help='only print dots, results summary and failure logs')438parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")439parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure')440parser.add_argument('--filter', help='filter scripts to run by regular expression')441parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true",442help="Leave bitcoinds and test.* datadir on exit or error")443parser.add_argument('--resultsfile', '-r', help='store test results (as CSV) to the provided file')445args, unknown_args = parser.parse_known_args()446# Fail on self-check warnings before running the tests.447fail_on_warn = True448if not args.ansi:449global DEFAULT, BOLD, GREEN, RED450DEFAULT = ("", "")451BOLD = ("", "")452GREEN = ("", "")453RED = ("", "")455# args to be passed on always start with two dashes; tests are the remaining unknown args456tests = [arg for arg in unknown_args if arg[:2] != "--"]457passon_args = [arg for arg in unknown_args if arg[:2] == "--"]459# Read config generated by configure.460config = configparser.ConfigParser()461configfile = os.path.abspath(os.path.dirname(__file__)) + "/../config.ini"462config.read_file(open(configfile))464passon_args.append("--configfile=%s" % configfile)466# Set up logging467logging_level = logging.INFO if args.quiet else logging.DEBUG468logging.basicConfig(format='%(message)s', level=logging_level)470# Create base test directory471tmpdir = "%s/test_runner_₿_🏃_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))473os.makedirs(tmpdir)475logging.debug("Temporary test directory at %s" % tmpdir)477results_filepath = None478if args.resultsfile:479results_filepath = pathlib.Path(args.resultsfile)480# Stop early if the parent directory doesn't exist481assert results_filepath.parent.exists(), "Results file parent directory does not exist"482logging.debug("Test results will be written to " + str(results_filepath))484enable_bitcoind = config.getboolean("components", "ENABLE_BITCOIND")486if not enable_bitcoind:487print("No functional tests to run.")488print("Re-compile with the -DBUILD_DAEMON=ON build option")489sys.exit(1)491export_env_build_path(config)493# Build tests494test_list = deque()495if tests:496# Individual tests have been specified. Run specified tests that exist497# in the ALL_SCRIPTS list. Accept names with or without a .py extension.498# Specified tests can contain wildcards, but in that case the supplied499# paths should be coherent, e.g. the same path as that provided to call500# test_runner.py. Examples:
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.