Inside Bitcoin
Opening the selected file…
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// Copyright (c) 2022-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <util/check.h>7#include <bitcoin-build-config.h> // IWYU pragma: keep9#include <clientversion.h>10#include <tinyformat.h>12#include <cstdio>13#include <cstdlib>14#include <source_location>15#include <string>16#include <string_view>18std::string StrFormatInternalBug(std::string_view msg, const std::source_location& loc)19{20return strprintf("Internal bug detected: %s\n%s:%d (%s)\n"21"%s %s\n"22"Please report this issue here: %s\n",23msg, loc.file_name(), loc.line(), loc.function_name(),24CLIENT_NAME, FormatFullVersion(), CLIENT_BUGREPORT);25}27NonFatalCheckError::NonFatalCheckError(std::string_view msg, const std::source_location& loc)28: std::runtime_error{StrFormatInternalBug(msg, loc)}29{30}32bool g_detail_test_only_CheckFailuresAreExceptionsNotAborts{false};34void assertion_fail(const std::source_location& loc, std::string_view assertion)35{36if (g_detail_test_only_CheckFailuresAreExceptionsNotAborts) {37throw NonFatalCheckError{assertion, loc};38}39auto str = strprintf("%s:%s %s: Assertion `%s' failed.\n", loc.file_name(), loc.line(), loc.function_name(), assertion);40fwrite(str.data(), 1, str.size(), stderr);41std::abort();42}44std::atomic<bool> g_enable_dynamic_fuzz_determinism{false};