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 bash2# Copyright (c) 2017-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.6# This simple script checks for commits beginning with: scripted-diff:7# If found, looks for a script between the lines -BEGIN VERIFY SCRIPT- and8# -END VERIFY SCRIPT-. If no ending is found, it reads until the end of the9# commit message.11# The resulting script should exactly transform the previous commit into the current12# one. Any remaining diff signals an error.14export LC_ALL=C.UTF-815if test -z "$1"; then16echo "Usage: $0 <commit>..."17exit 118fi20if ! sed --help 2>&1 | grep -q 'GNU'; then21echo "Error: the installed sed package is not compatible. Please make sure you have GNU sed installed in your system.";22exit 1;23fi25if ! grep --help 2>&1 | grep -q 'GNU'; then26echo "Error: the installed grep package is not compatible. Please make sure you have GNU grep installed in your system.";27exit 1;28fi30RET=031PREV_BRANCH=$(git name-rev --name-only HEAD)32PREV_HEAD=$(git rev-parse HEAD)33for commit in $(git rev-list --reverse "$1"); do34if git rev-list -n 1 --pretty="%s" "$commit" | grep -q "^scripted-diff:"; then35git checkout --quiet "$commit"^ || exit36SCRIPT="$(git rev-list --format=%b -n1 "$commit" | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d')"37if test -z "$SCRIPT"; then38echo "Error: missing script for: $commit" >&239echo "Failed" >&240RET=141else42echo "Running script for: $commit" >&243echo "$SCRIPT" >&244if bash -o errexit -o nounset -o pipefail -c "$SCRIPT" && git --no-pager diff --exit-code "$commit"; then45echo "OK" >&246else47echo "Failed" >&248RET=149fi50fi51git reset --quiet --hard HEAD52else53if git rev-list "--format=%b" -n1 "$commit" | grep -q '^-\(BEGIN\|END\)[ a-zA-Z]*-$'; then54echo "Error: script block marker but no scripted-diff in title of commit $commit" >&255echo "Failed" >&256RET=157fi58fi59done60git checkout --quiet "$PREV_BRANCH" 2>/dev/null || git checkout --quiet "$PREV_HEAD"61exit $RET
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.