Coverage Report

Created: 2025-12-17 17:26

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/bitcoin/src/util/check.h
Line
Count
Source
1
// Copyright (c) 2019-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_UTIL_CHECK_H
6
#define BITCOIN_UTIL_CHECK_H
7
8
#include <attributes.h>
9
10
#include <atomic>
11
#include <cassert> // IWYU pragma: export
12
#include <source_location>
13
#include <stdexcept>
14
#include <string>
15
#include <string_view>
16
#include <utility>
17
18
constexpr bool G_FUZZING_BUILD{
19
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
20
    true
21
#else
22
    false
23
#endif
24
};
25
constexpr bool G_ABORT_ON_FAILED_ASSUME{G_FUZZING_BUILD ||
26
#ifdef ABORT_ON_FAILED_ASSUME
27
    true
28
#else
29
    false
30
#endif
31
};
32
33
extern std::atomic<bool> g_enable_dynamic_fuzz_determinism;
34
35
inline bool EnableFuzzDeterminism()
36
0
{
37
0
    if constexpr (G_FUZZING_BUILD) {
38
0
        return true;
39
    } else if constexpr (!G_ABORT_ON_FAILED_ASSUME) {
40
        // Running fuzz tests is always disabled if Assume() doesn't abort
41
        // (ie, non-fuzz non-debug builds), as otherwise tests which
42
        // should fail due to a failing Assume may still pass. As such,
43
        // we also statically disable fuzz determinism in that case.
44
        return false;
45
    } else {
46
        return g_enable_dynamic_fuzz_determinism;
47
    }
48
0
}
49
50
extern bool g_detail_test_only_CheckFailuresAreExceptionsNotAborts;
51
struct test_only_CheckFailuresAreExceptionsNotAborts {
52
0
    test_only_CheckFailuresAreExceptionsNotAborts() { g_detail_test_only_CheckFailuresAreExceptionsNotAborts = true; };
53
0
    ~test_only_CheckFailuresAreExceptionsNotAborts() { g_detail_test_only_CheckFailuresAreExceptionsNotAborts = false; };
54
};
55
56
std::string StrFormatInternalBug(std::string_view msg, const std::source_location& loc);
57
58
class NonFatalCheckError : public std::runtime_error
59
{
60
public:
61
    NonFatalCheckError(std::string_view msg, const std::source_location& loc);
62
};
63
64
/** Internal helper */
65
void assertion_fail(const std::source_location& loc, std::string_view assertion);
66
67
/** Helper for CHECK_NONFATAL() */
68
template <typename T>
69
T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const std::source_location& loc, std::string_view assertion)
70
0
{
71
0
    if (!val) {
72
0
        if constexpr (G_ABORT_ON_FAILED_ASSUME) {
73
0
            assertion_fail(loc, assertion);
74
0
        }
75
0
        throw NonFatalCheckError{assertion, loc};
76
0
    }
77
0
    return std::forward<T>(val);
78
0
}
Unexecuted instantiation: _Z22inline_check_non_fatalIbEOT_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRKbEOT_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRbEOT_S2_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRPK14JSONRPCRequestEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRPK8UniValueEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalISt8optionalI13arith_uint256EEOT_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRPN6wallet25DescriptorScriptPubKeyManEEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIPK11CBlockIndexEOT_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalISt10unique_ptrI16CCoinsViewCursorSt14default_deleteIS1_EEEOT_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRPK11CBlockIndexEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIPN4node12BlockManagerEEOT_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalISt10shared_ptrIK12CTransactionEEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRP11CBlockIndexEOT_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalISt8optionalIN10interfaces8BlockRefEEEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRSt10unique_ptrI17ValidationSignalsSt14default_deleteIS1_EEEOT_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIP11CBlockIndexEOT_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRKP11CBlockIndexEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRSt10unique_ptrIN4node8WarningsESt14default_deleteIS2_EEEOT_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRSt8optionalIN6kernel11CCoinsStatsEEEOT_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRKP17ValidationSignalsEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRKSt10unique_ptrI17ValidationSignalsSt14default_deleteIS1_EEEOT_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRSt10unique_ptrIN10interfaces13BlockTemplateESt14default_deleteIS2_EEEOT_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRKSt10unique_ptrI10CSchedulerSt14default_deleteIS1_EEEOT_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_check_non_fatalIRSt8functionIFbvEEEOT_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
79
80
#if defined(NDEBUG)
81
#error "Cannot compile without assertions!"
82
#endif
83
84
/** Helper for Assert()/Assume() */
85
template <bool IS_ASSERT, typename T>
86
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const std::source_location& loc, [[maybe_unused]] std::string_view assertion)
87
186M
{
88
186M
    if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
89
186M
        if (!val) {
90
0
            assertion_fail(loc, assertion);
91
0
        }
92
186M
    }
93
186M
    return std::forward<T>(val);
94
186M
}
_Z22inline_assertion_checkILb0EbEOT0_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Line
Count
Source
87
186M
{
88
186M
    if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
89
186M
        if (!val) {
90
0
            assertion_fail(loc, assertion);
91
0
        }
92
186M
    }
93
186M
    return std::forward<T>(val);
94
186M
}
Unexecuted instantiation: _Z22inline_assertion_checkILb0EiEOT0_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKhEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt10unique_ptrI14LevelDBContextSt14default_deleteIS1_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrI10CoinsViewsSt14default_deleteIS1_EEEOT0_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrI15CCoinsViewCacheSt14default_deleteIS1_EEEOT0_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalI13arith_uint256EEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalI7uint256EEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
_Z22inline_assertion_checkILb0ERmEOT0_S2_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Line
Count
Source
87
53.2k
{
88
53.2k
    if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
89
53.2k
        if (!val) {
90
0
            assertion_fail(loc, assertion);
91
0
        }
92
53.2k
    }
93
53.2k
    return std::forward<T>(val);
94
53.2k
}
_Z22inline_assertion_checkILb0ERbEOT0_S2_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Line
Count
Source
87
3.84k
{
88
3.84k
    if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
89
3.84k
        if (!val) {
90
0
            assertion_fail(loc, assertion);
91
0
        }
92
3.84k
    }
93
3.84k
    return std::forward<T>(val);
94
3.84k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKmEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1E10MinisketchEOT0_S2_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt8optionalISt6vectorImSaImEEEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
_Z22inline_assertion_checkILb1EbEOT0_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Line
Count
Source
87
1.57k
{
88
1.57k
    if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
89
1.57k
        if (!val) {
90
0
            assertion_fail(loc, assertion);
91
0
        }
92
1.57k
    }
93
1.57k
    return std::forward<T>(val);
94
1.57k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERbEOT0_S2_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK13MappingResultEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPK15CTxMemPoolEntryEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ElEOT0_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKbEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalIlEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalI8CFeeRateEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalISt6vectorI22transaction_identifierILb1EESaIS3_EEEEOT0_SA_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK11CBlockIndexEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt8optionalIN6kernel11CCoinsStatsEEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt8optionalI14AssumeutxoDataEEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrI17ChainstateManagerSt14default_deleteIS1_EEEOT0_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt8optionalIiEEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EN4util6ResultISt17reference_wrapperIN6wallet25DescriptorScriptPubKeyManEEEEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt8optionalI10OutputTypeEEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EN4util6ResultISt7variantIJ14CNoDestination17PubKeyDestination6PKHash10ScriptHash19WitnessV0ScriptHash16WitnessV0KeyHash16WitnessV1Taproot11PayToAnchor14WitnessUnknownEEEEEOT0_SF_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
_Z22inline_assertion_checkILb1ERPKSt8functionIFvSt4spanIKhLm18446744073709551615EEEEEOT0_SA_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Line
Count
Source
87
789
{
88
789
    if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
89
789
        if (!val) {
90
0
            assertion_fail(loc, assertion);
91
0
        }
92
789
    }
93
789
    return std::forward<T>(val);
94
789
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalIN2fs4pathEEEOT0_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt8optionalI19CMutableTransactionEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKbEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERSt8optionalISt4pairI11XOnlyPubKeybEEEOT0_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKPSt3mapI7uint25614MuSig2SecNonceSt4lessIS1_ESaISt4pairIKS1_S2_EEEEOT0_SE_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPKN6wallet9CWalletTxEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EmEOT0_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKPK7uint256EOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP11ArgsManagerEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERPN6wallet14LegacyDataSPKMEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP10CSchedulerEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrIN6wallet17SQliteExecHandlerESt14default_deleteIS2_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt10unique_ptrI17ChainstateManagerSt14default_deleteIS1_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EP10CTxMemPoolEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt6atomicIbEEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt8functionIFbvEEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrIN4node8WarningsESt14default_deleteIS2_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPN4util15SignalInterruptEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKN4util6ResultIvEEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt8optionalI18PresaltedSipHasherEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPK11CBlockIndexEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EP17evhttp_connectionEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP14evhttp_requestEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK17evhttp_connectionEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt8optionalIN4util15SignalInterruptEEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EN4util6ResultIvEEEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrI17ValidationSignalsSt14default_deleteIS1_EEEOT0_S7_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrIN4node19KernelNotificationsESt14default_deleteIS2_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EP11CBlockIndexEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP11CBlockIndexEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: net_processing.cpp:_Z22inline_assertion_checkILb1EPN12_GLOBAL__N_110CNodeStateEEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: net_processing.cpp:_Z22inline_assertion_checkILb1ESt10shared_ptrIN12_GLOBAL__N_14PeerEEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0EP11CBlockIndexEOT0_S3_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalI14AssumeutxoDataEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt8optionalIN4node15BlockfileCursorEEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPN4node11NodeContextEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPN4node11NodeContextEEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPN10interfaces12WalletLoaderEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKSt8optionalI7uint256EEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ESt8optionalI7uint256EEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0EjEOT0_S1_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERPKN7TxGraph3RefEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: txgraph.cpp:_Z22inline_assertion_checkILb0ERPN12_GLOBAL__N_17ClusterEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERSt10unique_ptrIN10CTxMemPool9ChangeSetESt14default_deleteIS2_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK7uint256EOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKSt8optionalIiEEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKP11CBlockIndexEOT0_S5_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt10unique_ptrI10ChainstateSt14default_deleteIS1_EEEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERSt10unique_ptrIN4util19TaskRunnerInterfaceESt14default_deleteIS2_EEEOT0_S8_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKPK6CBlockEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKPK10CBlockUndoEOT0_S6_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
Unexecuted instantiation: _Z22inline_assertion_checkILb1ESt8optionalI7uint256EEOT0_S4_RKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE
95
96
0
#define STR_INTERNAL_BUG(msg) StrFormatInternalBug((msg), std::source_location::current())
97
98
/**
99
 * Identity function. Throw a NonFatalCheckError when the condition evaluates to false
100
 *
101
 * This should only be used
102
 * - where the condition is assumed to be true, not for error handling or validating user input
103
 * - where a failure to fulfill the condition is recoverable and does not abort the program
104
 *
105
 * For example in RPC code, where it is undesirable to crash the whole program, this can be generally used to replace
106
 * asserts or recoverable logic errors. A NonFatalCheckError in RPC code is caught and passed as a string to the RPC
107
 * caller, which can then report the issue to the developers.
108
 */
109
#define CHECK_NONFATAL(condition) \
110
0
    inline_check_non_fatal(condition, std::source_location::current(), #condition)
Unexecuted instantiation: blockchain.cpp:_ZZL12GetUTXOStatsP10CCoinsViewRN4node12BlockManagerEN6kernel17CoinStatsHashTypeERKSt8functionIFvvEEPK11CBlockIndexbENK3$_0clEv
Unexecuted instantiation: blockchain.cpp:_ZZZL10scanblocksvENK3$_0clERK10RPCHelpManRK14JSONRPCRequestENKUlvE0_clEv
111
112
/** Identity function. Abort if the value compares equal to zero */
113
2.36k
#define Assert(val) inline_assertion_check<true>(val, std::source_location::current(), #val)
Unexecuted instantiation: txmempool.cpp:_ZZ31CheckMempoolEphemeralInvariantsRK10CTxMemPoolENK3$_0clERK5CTxIn
Unexecuted instantiation: blockstorage.cpp:_ZZN4node12BlockManager14WriteBlockUndoERK10CBlockUndoR20BlockValidationStateR11CBlockIndexENK3$_0clEv
114
115
/**
116
 * Assume is the identity function.
117
 *
118
 * - Should be used to run non-fatal checks. In debug builds it behaves like
119
 *   Assert()/assert() to notify developers and testers about non-fatal errors.
120
 *   In production it doesn't warn or log anything.
121
 * - For fatal errors, use Assert().
122
 * - For non-fatal errors in interactive sessions (e.g. RPC or command line
123
 *   interfaces), CHECK_NONFATAL() might be more appropriate.
124
 */
125
186M
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
Unexecuted instantiation: scriptpubkeyman.cpp:_ZZNK6wallet25DescriptorScriptPubKeyMan6GetKeyERK6CKeyIDENK3$_0clERKSt6vectorIh16secure_allocatorIhEE
Unexecuted instantiation: wallet.cpp:_ZZNK6wallet7CWallet19GetScriptPubKeyMansERK7CScriptENK3$_0clEPNS_15ScriptPubKeyManE
Unexecuted instantiation: net_processing.cpp:_ZZN12_GLOBAL__N_115PeerManagerImpl14ProcessMessageER5CNodeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER10DataStreamNSt6chrono8durationIlSt5ratioILl1ELl1000000EEEERKSt6atomicIbEENK3$_2clEv
Unexecuted instantiation: mini_miner.cpp:_ZZNK4node9MiniMiner11SanityCheckEvENK3$_0clISt17_Rb_tree_iteratorISt4pairIK22transaction_identifierILb0EENS_21MiniMinerMempoolEntryEEEEEDaRKT_
Unexecuted instantiation: mini_miner.cpp:_ZZNK4node9MiniMiner11SanityCheckEvENK3$_1clI22transaction_identifierILb0EEEEDaRKT_
Unexecuted instantiation: validation.cpp:_ZZN17ChainstateManager25ReceivedBlockTransactionsERK6CBlockP11CBlockIndexRK11FlatFilePosENK3$_0clISt10unique_ptrI10ChainstateSt14default_deleteISB_EEEEDaRKT_
Unexecuted instantiation: ephemeral_policy.cpp:_ZZ20CheckEphemeralSpendsRKSt6vectorISt10shared_ptrIK12CTransactionESaIS3_EE8CFeeRateRK10CTxMemPoolR17TxValidationStateR22transaction_identifierILb1EEENK3$_0clIS3_EEDaRKT_
126
127
/**
128
 * NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code. It throws a NonFatalCheckError.
129
 */
130
#define NONFATAL_UNREACHABLE() \
131
0
    throw NonFatalCheckError { "Unreachable code reached (non-fatal)", std::source_location::current() }
132
133
#if defined(__has_feature)
134
#    if __has_feature(address_sanitizer)
135
#       include <sanitizer/asan_interface.h>
136
#    endif
137
#endif
138
139
#ifndef ASAN_POISON_MEMORY_REGION
140
0
#   define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
141
0
#   define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
142
#endif
143
144
#endif // BITCOIN_UTIL_CHECK_H