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) The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or https://opensource.org/license/mit/.6import os7import shlex8import subprocess9import sys10import time11from pathlib import Path14def run(cmd, **kwargs):15print("+ " + shlex.join(cmd), flush=True)16kwargs.setdefault("check", True)17try:18return subprocess.run(cmd, **kwargs)19except Exception as e:20sys.exit(str(e))23def get_worktree_mounts(repo_root):24git_path = repo_root / ".git"25if not git_path.is_file():26return []27content = git_path.read_text().strip()28if not content.startswith("gitdir: "):29return []30gitdir = (repo_root / content.removeprefix("gitdir: ")).resolve()31main_gitdir = gitdir.parent.parent32return [33f"--volume={gitdir}:{gitdir}",34f"--volume={main_gitdir}:{main_gitdir}",35]38def main():39repo_root = Path(__file__).resolve().parent.parent40is_ci = os.environ.get("GITHUB_ACTIONS") == "true"41container = "bitcoin-linter"43build_cmd = [44"docker",45"buildx",46"build",47"--platform=linux",48f"--tag={container}",49*shlex.split(os.environ.get("DOCKER_BUILD_CACHE_ARG", "")),50f"--file={repo_root}/ci/lint_imagefile",51str(repo_root),52]53if run(build_cmd, check=False).returncode != 0:54if is_ci:55print("Retry building image after failure")56time.sleep(3)57run(build_cmd)59extra_env = []60if is_ci:61if os.environ.get("GITHUB_EVENT_NAME") == "pull_request":62extra_env = ["--env", "LINT_CI_IS_PR=1"]63elif os.environ.get("GITHUB_REPOSITORY") == "bitcoin/bitcoin":64extra_env = ["--env", "LINT_CI_SANITY_CHECK_COMMIT_SIG=1"]66run(67[68"docker",69"run",70"--rm",71*extra_env,72f"--volume={repo_root}:/bitcoin",73*get_worktree_mounts(repo_root),74*([] if is_ci else ["-it"]),75container,76"./ci/lint/06_script.sh",77*sys.argv[1:],78]79)82if __name__ == "__main__":83main()
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.