Coverage Report

Created: 2025-05-14 12:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/bitcoin/src/consensus/validation.h
Line
Count
Source
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-2022 The Bitcoin Core developers
3
// Distributed under the MIT software license, see the accompanying
4
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6
#ifndef BITCOIN_CONSENSUS_VALIDATION_H
7
#define BITCOIN_CONSENSUS_VALIDATION_H
8
9
#include <string>
10
#include <consensus/consensus.h>
11
#include <primitives/transaction.h>
12
#include <primitives/block.h>
13
14
/** Index marker for when no witness commitment is present in a coinbase transaction. */
15
static constexpr int NO_WITNESS_COMMITMENT{-1};
16
17
/** Minimum size of a witness commitment structure. Defined in BIP 141. **/
18
static constexpr size_t MINIMUM_WITNESS_COMMITMENT{38};
19
20
/** A "reason" why a transaction was invalid, suitable for determining whether the
21
  * provider of the transaction should be banned/ignored/disconnected/etc.
22
  */
23
enum class TxValidationResult {
24
    TX_RESULT_UNSET = 0,     //!< initial value. Tx has not yet been rejected
25
    TX_CONSENSUS,            //!< invalid by consensus rules
26
    TX_INPUTS_NOT_STANDARD,   //!< inputs (covered by txid) failed policy rules
27
    TX_NOT_STANDARD,          //!< otherwise didn't meet our local policy rules
28
    TX_MISSING_INPUTS,        //!< transaction was missing some of its inputs
29
    TX_PREMATURE_SPEND,       //!< transaction spends a coinbase too early, or violates locktime/sequence locks
30
    /**
31
     * Transaction might have a witness prior to SegWit
32
     * activation, or witness may have been malleated (which includes
33
     * non-standard witnesses).
34
     */
35
    TX_WITNESS_MUTATED,
36
    /**
37
     * Transaction is missing a witness.
38
     */
39
    TX_WITNESS_STRIPPED,
40
    /**
41
     * Tx already in mempool or conflicts with a tx in the chain
42
     * (if it conflicts with another tx in mempool, we use MEMPOOL_POLICY as it failed to reach the RBF threshold)
43
     * Currently this is only used if the transaction already exists in the mempool or on chain.
44
     */
45
    TX_CONFLICT,
46
    TX_MEMPOOL_POLICY,        //!< violated mempool's fee/size/descendant/RBF/etc limits
47
    TX_NO_MEMPOOL,            //!< this node does not have a mempool so can't validate the transaction
48
    TX_RECONSIDERABLE,        //!< fails some policy, but might be acceptable if submitted in a (different) package
49
    TX_UNKNOWN,               //!< transaction was not validated because package failed
50
};
51
52
/** A "reason" why a block was invalid, suitable for determining whether the
53
  * provider of the block should be banned/ignored/disconnected/etc.
54
  * These are much more granular than the rejection codes, which may be more
55
  * useful for some other use-cases.
56
  */
57
enum class BlockValidationResult {
58
    BLOCK_RESULT_UNSET = 0,  //!< initial value. Block has not yet been rejected
59
    BLOCK_CONSENSUS,         //!< invalid by consensus rules (excluding any below reasons)
60
    BLOCK_CACHED_INVALID,    //!< this block was cached as being invalid and we didn't store the reason why
61
    BLOCK_INVALID_HEADER,    //!< invalid proof of work or time too old
62
    BLOCK_MUTATED,           //!< the block's data didn't match the data committed to by the PoW
63
    BLOCK_MISSING_PREV,      //!< We don't have the previous block the checked one is built on
64
    BLOCK_INVALID_PREV,      //!< A block this one builds on is invalid
65
    BLOCK_TIME_FUTURE,       //!< block timestamp was > 2 hours in the future (or our clock is bad)
66
    BLOCK_HEADER_LOW_WORK    //!< the block header may be on a too-little-work chain
67
};
68
69
70
71
/** Template for capturing information about block/transaction validation. This is instantiated
72
 *  by TxValidationState and BlockValidationState for validation information on transactions
73
 *  and blocks respectively. */
74
template <typename Result>
75
class ValidationState
76
{
77
private:
78
    enum class ModeState {
79
        M_VALID,   //!< everything ok
80
        M_INVALID, //!< network rule violation (DoS value may be set)
81
        M_ERROR,   //!< run-time error
82
    } m_mode{ModeState::M_VALID};
83
    Result m_result{};
84
    std::string m_reject_reason;
85
    std::string m_debug_message;
86
87
public:
88
    bool Invalid(Result result,
89
                 const std::string& reject_reason = "",
90
                 const std::string& debug_message = "")
91
95
    {
92
95
        m_result = result;
93
95
        m_reject_reason = reject_reason;
94
95
        m_debug_message = debug_message;
95
95
        if (m_mode != ModeState::M_ERROR) m_mode = ModeState::M_INVALID;
96
95
        return false;
97
95
    }
Unexecuted instantiation: _ZN15ValidationStateI21BlockValidationResultE7InvalidES0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_
_ZN15ValidationStateI18TxValidationResultE7InvalidES0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_
Line
Count
Source
91
95
    {
92
95
        m_result = result;
93
95
        m_reject_reason = reject_reason;
94
95
        m_debug_message = debug_message;
95
95
        if (m_mode != ModeState::M_ERROR) m_mode = ModeState::M_INVALID;
96
95
        return false;
97
95
    }
Unexecuted instantiation: _ZN15ValidationStateI23PackageValidationResultE7InvalidES0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_
98
    bool Error(const std::string& reject_reason)
99
0
    {
100
0
        if (m_mode == ModeState::M_VALID)
101
0
            m_reject_reason = reject_reason;
102
0
        m_mode = ModeState::M_ERROR;
103
0
        return false;
104
0
    }
105
0
    bool IsValid() const { return m_mode == ModeState::M_VALID; }
Unexecuted instantiation: _ZNK15ValidationStateI21BlockValidationResultE7IsValidEv
Unexecuted instantiation: _ZNK15ValidationStateI18TxValidationResultE7IsValidEv
Unexecuted instantiation: _ZNK15ValidationStateI23PackageValidationResultE7IsValidEv
106
0
    bool IsInvalid() const { return m_mode == ModeState::M_INVALID; }
Unexecuted instantiation: _ZNK15ValidationStateI21BlockValidationResultE9IsInvalidEv
Unexecuted instantiation: _ZNK15ValidationStateI18TxValidationResultE9IsInvalidEv
Unexecuted instantiation: _ZNK15ValidationStateI23PackageValidationResultE9IsInvalidEv
107
0
    bool IsError() const { return m_mode == ModeState::M_ERROR; }
108
0
    Result GetResult() const { return m_result; }
Unexecuted instantiation: _ZNK15ValidationStateI23PackageValidationResultE9GetResultEv
Unexecuted instantiation: _ZNK15ValidationStateI18TxValidationResultE9GetResultEv
Unexecuted instantiation: _ZNK15ValidationStateI21BlockValidationResultE9GetResultEv
109
0
    std::string GetRejectReason() const { return m_reject_reason; }
Unexecuted instantiation: _ZNK15ValidationStateI18TxValidationResultE15GetRejectReasonB5cxx11Ev
Unexecuted instantiation: _ZNK15ValidationStateI23PackageValidationResultE15GetRejectReasonB5cxx11Ev
Unexecuted instantiation: _ZNK15ValidationStateI21BlockValidationResultE15GetRejectReasonB5cxx11Ev
110
0
    std::string GetDebugMessage() const { return m_debug_message; }
111
    std::string ToString() const
112
0
    {
113
0
        if (IsValid()) {
114
0
            return "Valid";
115
0
        }
116
117
0
        if (!m_debug_message.empty()) {
118
0
            return m_reject_reason + ", " + m_debug_message;
119
0
        }
120
121
0
        return m_reject_reason;
122
0
    }
Unexecuted instantiation: _ZNK15ValidationStateI21BlockValidationResultE8ToStringB5cxx11Ev
Unexecuted instantiation: _ZNK15ValidationStateI23PackageValidationResultE8ToStringB5cxx11Ev
Unexecuted instantiation: _ZNK15ValidationStateI18TxValidationResultE8ToStringB5cxx11Ev
123
};
124
125
class TxValidationState : public ValidationState<TxValidationResult> {};
126
class BlockValidationState : public ValidationState<BlockValidationResult> {};
127
128
// These implement the weight = (stripped_size * 4) + witness_size formula,
129
// using only serialization with and without witness data. As witness_size
130
// is equal to total_size - stripped_size, this formula is identical to:
131
// weight = (stripped_size * 3) + total_size.
132
static inline int32_t GetTransactionWeight(const CTransaction& tx)
133
0
{
134
0
    return ::GetSerializeSize(TX_NO_WITNESS(tx)) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(TX_WITH_WITNESS(tx));
135
0
}
Unexecuted instantiation: addrman.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: banman.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: block.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: block_index.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: coins_view.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: connman.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: feeratediagram.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: headerssync.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: i2p.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: load_external_block_file.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: mini_miner.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: net.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: net_permissions.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: netaddress.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: netbase_dns_lookup.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: node_eviction.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: p2p_handshake.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: p2p_headers_presync.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: pcp.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: package_eval.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: partially_downloaded_block.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: policy_estimator.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: process_message.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: process_messages.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: rbf.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: signet.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: socks5.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: transaction.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txdownloadman.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: tx_in.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: tx_out.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: tx_pool.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txorphan.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: utxo_snapshot.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: utxo_total_supply.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: validation_load_mempool.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: fees.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: scriptpubkeyman.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: spend.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: mempool.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: core_write.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: policy.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: wallet.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: feebumper.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: transactions.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: mining.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: setup_common.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: transaction_utils.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txmempool.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: validation.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: blockencodings.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: tx_verify.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: init.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: coinstats.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: net_processing.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: blockmanager_args.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: blockstorage.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: chainstate.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: chainstatemanager_args.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: context.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: interfaces.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: mempool_persist.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: mempool_persist_args.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: miner.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: peerman_args.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txdownloadman_impl.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: packages.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: rest.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: blockchain.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: rawtransaction.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: server.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: server_util.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txoutproof.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txorphanage.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: validationinterface.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: base.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: blockfilterindex.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: coinstatsindex.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: txindex.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: coin.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: ephemeral_policy.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: truc_policy.cpp:_ZL20GetTransactionWeightRK12CTransaction
Unexecuted instantiation: tx_check.cpp:_ZL20GetTransactionWeightRK12CTransaction
136
static inline int64_t GetBlockWeight(const CBlock& block)
137
0
{
138
0
    return ::GetSerializeSize(TX_NO_WITNESS(block)) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(TX_WITH_WITNESS(block));
139
0
}
Unexecuted instantiation: addrman.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: banman.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: block.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: block_index.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: coins_view.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: connman.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: feeratediagram.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: headerssync.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: i2p.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: load_external_block_file.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: mini_miner.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: net.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: net_permissions.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: netaddress.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: netbase_dns_lookup.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: node_eviction.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: p2p_handshake.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: p2p_headers_presync.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: pcp.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: package_eval.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: partially_downloaded_block.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: policy_estimator.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: process_message.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: process_messages.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: rbf.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: signet.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: socks5.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: transaction.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txdownloadman.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: tx_in.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: tx_out.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: tx_pool.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txorphan.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: utxo_snapshot.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: utxo_total_supply.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: validation_load_mempool.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: fees.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: scriptpubkeyman.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: spend.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: mempool.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: core_write.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: policy.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: wallet.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: feebumper.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: transactions.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: mining.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: setup_common.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: transaction_utils.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txmempool.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: validation.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: blockencodings.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: tx_verify.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: init.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: coinstats.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: net_processing.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: blockmanager_args.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: blockstorage.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: chainstate.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: chainstatemanager_args.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: context.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: interfaces.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: mempool_persist.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: mempool_persist_args.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: miner.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: peerman_args.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txdownloadman_impl.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: packages.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: rest.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: blockchain.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: rawtransaction.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: server.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: server_util.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txoutproof.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txorphanage.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: validationinterface.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: base.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: blockfilterindex.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: coinstatsindex.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: txindex.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: coin.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: ephemeral_policy.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: truc_policy.cpp:_ZL14GetBlockWeightRK6CBlock
Unexecuted instantiation: tx_check.cpp:_ZL14GetBlockWeightRK6CBlock
140
static inline int64_t GetTransactionInputWeight(const CTxIn& txin)
141
0
{
142
    // scriptWitness size is added here because witnesses and txins are split up in segwit serialization.
143
0
    return ::GetSerializeSize(TX_NO_WITNESS(txin)) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(TX_WITH_WITNESS(txin)) + ::GetSerializeSize(txin.scriptWitness.stack);
144
0
}
Unexecuted instantiation: addrman.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: banman.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: block.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: block_index.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: coins_view.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: connman.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: feeratediagram.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: headerssync.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: i2p.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: load_external_block_file.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: mini_miner.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: net.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: net_permissions.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: netaddress.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: netbase_dns_lookup.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: node_eviction.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: p2p_handshake.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: p2p_headers_presync.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: pcp.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: package_eval.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: partially_downloaded_block.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: policy_estimator.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: process_message.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: process_messages.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: rbf.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: signet.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: socks5.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: transaction.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txdownloadman.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: tx_in.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: tx_out.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: tx_pool.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txorphan.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: utxo_snapshot.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: utxo_total_supply.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: validation_load_mempool.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: fees.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: scriptpubkeyman.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: spend.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: mempool.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: core_write.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: policy.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: wallet.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: feebumper.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: transactions.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: mining.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: setup_common.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: transaction_utils.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txmempool.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: validation.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: blockencodings.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: tx_verify.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: init.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: coinstats.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: net_processing.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: blockmanager_args.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: blockstorage.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: chainstate.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: chainstatemanager_args.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: context.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: interfaces.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: mempool_persist.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: mempool_persist_args.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: miner.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: peerman_args.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txdownloadman_impl.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: packages.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: rest.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: blockchain.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: rawtransaction.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: server.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: server_util.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txoutproof.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txorphanage.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: validationinterface.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: base.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: blockfilterindex.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: coinstatsindex.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: txindex.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: coin.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: ephemeral_policy.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: truc_policy.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
Unexecuted instantiation: tx_check.cpp:_ZL25GetTransactionInputWeightRK5CTxIn
145
146
/** Compute at which vout of the block's coinbase transaction the witness commitment occurs, or -1 if not found */
147
inline int GetWitnessCommitmentIndex(const CBlock& block)
148
0
{
149
0
    int commitpos = NO_WITNESS_COMMITMENT;
150
0
    if (!block.vtx.empty()) {
151
0
        for (size_t o = 0; o < block.vtx[0]->vout.size(); o++) {
152
0
            const CTxOut& vout = block.vtx[0]->vout[o];
153
0
            if (vout.scriptPubKey.size() >= MINIMUM_WITNESS_COMMITMENT &&
154
0
                vout.scriptPubKey[0] == OP_RETURN &&
155
0
                vout.scriptPubKey[1] == 0x24 &&
156
0
                vout.scriptPubKey[2] == 0xaa &&
157
0
                vout.scriptPubKey[3] == 0x21 &&
158
0
                vout.scriptPubKey[4] == 0xa9 &&
159
0
                vout.scriptPubKey[5] == 0xed) {
160
0
                commitpos = o;
161
0
            }
162
0
        }
163
0
    }
164
0
    return commitpos;
165
0
}
166
167
#endif // BITCOIN_CONSENSUS_VALIDATION_H