fuzz coverage

Coverage Report

Created: 2026-04-24 13:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/bitcoin/src/validationinterface.cpp
Line
Count
Source
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-present 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
#include <validationinterface.h>
7
8
#include <chain.h>
9
#include <consensus/validation.h>
10
#include <kernel/mempool_entry.h>
11
#include <kernel/mempool_removal_reason.h>
12
#include <kernel/types.h>
13
#include <primitives/block.h>
14
#include <primitives/transaction.h>
15
#include <util/check.h>
16
#include <util/log.h>
17
#include <util/task_runner.h>
18
19
#include <future>
20
#include <memory>
21
#include <unordered_map>
22
#include <utility>
23
24
using kernel::ChainstateRole;
25
26
/**
27
 * ValidationSignalsImpl manages a list of shared_ptr<CValidationInterface> callbacks.
28
 *
29
 * A std::unordered_map is used to track what callbacks are currently
30
 * registered, and a std::list is used to store the callbacks that are
31
 * currently registered as well as any callbacks that are just unregistered
32
 * and about to be deleted when they are done executing.
33
 */
34
class ValidationSignalsImpl
35
{
36
private:
37
    Mutex m_mutex;
38
    //! List entries consist of a callback pointer and reference count. The
39
    //! count is equal to the number of current executions of that entry, plus 1
40
    //! if it's registered. It cannot be 0 because that would imply it is
41
    //! unregistered and also not being executed (so shouldn't exist).
42
    struct ListEntry { std::shared_ptr<CValidationInterface> callbacks; int count = 1; };
43
    std::list<ListEntry> m_list GUARDED_BY(m_mutex);
44
    std::unordered_map<CValidationInterface*, std::list<ListEntry>::iterator> m_map GUARDED_BY(m_mutex);
45
46
public:
47
    std::unique_ptr<util::TaskRunnerInterface> m_task_runner;
48
49
    explicit ValidationSignalsImpl(std::unique_ptr<util::TaskRunnerInterface> task_runner)
50
0
        : m_task_runner{std::move(Assert(task_runner))} {}
Line
Count
Source
113
0
#define Assert(val) inline_assertion_check<true>(val, std::source_location::current(), #val)
51
52
    void Register(std::shared_ptr<CValidationInterface> callbacks) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
53
29.7M
    {
54
29.7M
        LOCK(m_mutex);
Line
Count
Source
268
29.7M
#define LOCK(cs) UniqueLock UNIQUE_NAME(criticalblock)(MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.7M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.7M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.7M
#define PASTE(x, y) x ## y
55
29.7M
        auto inserted = m_map.emplace(callbacks.get(), m_list.end());
56
29.7M
        if (inserted.second) inserted.first->second = m_list.emplace(m_list.end());
57
29.7M
        inserted.first->second->callbacks = std::move(callbacks);
58
29.7M
    }
59
60
    void Unregister(CValidationInterface* callbacks) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
61
29.5M
    {
62
29.5M
        LOCK(m_mutex);
Line
Count
Source
268
29.5M
#define LOCK(cs) UniqueLock UNIQUE_NAME(criticalblock)(MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.5M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.5M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.5M
#define PASTE(x, y) x ## y
63
29.5M
        auto it = m_map.find(callbacks);
64
29.5M
        if (it != m_map.end()) {
65
29.5M
            if (!--it->second->count) m_list.erase(it->second);
66
29.5M
            m_map.erase(it);
67
29.5M
        }
68
29.5M
    }
69
70
    //! Clear unregisters every previously registered callback, erasing every
71
    //! map entry. After this call, the list may still contain callbacks that
72
    //! are currently executing, but it will be cleared when they are done
73
    //! executing.
74
    void Clear() EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
75
190k
    {
76
190k
        LOCK(m_mutex);
Line
Count
Source
268
190k
#define LOCK(cs) UniqueLock UNIQUE_NAME(criticalblock)(MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__)
Line
Count
Source
11
190k
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
190k
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
190k
#define PASTE(x, y) x ## y
77
190k
        for (const auto& entry : m_map) {
78
190k
            if (!--entry.second->count) m_list.erase(entry.second);
79
190k
        }
80
190k
        m_map.clear();
81
190k
    }
82
83
    template<typename F> void Iterate(F&& f) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
84
181M
    {
85
181M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.0M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.0M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.0M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.0M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
1.03M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
1.03M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
556k
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
556k
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.1M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.1M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.1M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.1M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
26.9k
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
26.9k
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
0
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
0
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.1M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.1M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
29.8M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
29.8M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
363M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
181M
            ++it->count;
88
181M
            {
89
181M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
1.03M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
1.03M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
1.03M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
1.03M
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
556k
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
556k
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
556k
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
556k
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
26.9k
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
26.9k
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
26.9k
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
26.9k
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
0
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
0
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
0
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
0
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.8M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.8M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.8M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.8M
#define PASTE(x, y) x ## y
90
181M
                f(*it->callbacks);
91
181M
            }
92
181M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
181M
        }
94
181M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::UpdatedBlockTip(CBlockIndex const*, CBlockIndex const*, bool)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::UpdatedBlockTip(CBlockIndex const*, CBlockIndex const*, bool)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
Line
Count
Source
84
30.0M
    {
85
30.0M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.0M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.0M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
60.0M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
29.9M
            ++it->count;
88
29.9M
            {
89
29.9M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
90
29.9M
                f(*it->callbacks);
91
29.9M
            }
92
29.9M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
29.9M
        }
94
30.0M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::ActiveTipChange(CBlockIndex const&, bool)::$_0>(ValidationSignals::ActiveTipChange(CBlockIndex const&, bool)::$_0&&)
Line
Count
Source
84
30.0M
    {
85
30.0M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.0M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.0M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
60.0M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
29.9M
            ++it->count;
88
29.9M
            {
89
29.9M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
90
29.9M
                f(*it->callbacks);
91
29.9M
            }
92
29.9M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
29.9M
        }
94
30.0M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::TransactionAddedToMempool(NewMempoolTransactionInfo const&, unsigned long)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::TransactionAddedToMempool(NewMempoolTransactionInfo const&, unsigned long)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
Line
Count
Source
84
1.03M
    {
85
1.03M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
1.03M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
1.03M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
2.06M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
1.03M
            ++it->count;
88
1.03M
            {
89
1.03M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
1.03M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
1.03M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
1.03M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
1.03M
#define PASTE(x, y) x ## y
90
1.03M
                f(*it->callbacks);
91
1.03M
            }
92
1.03M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
1.03M
        }
94
1.03M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::TransactionRemovedFromMempool(std::shared_ptr<CTransaction const> const&, MemPoolRemovalReason, unsigned long)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::TransactionRemovedFromMempool(std::shared_ptr<CTransaction const> const&, MemPoolRemovalReason, unsigned long)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
Line
Count
Source
84
556k
    {
85
556k
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
556k
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
556k
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
1.11M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
556k
            ++it->count;
88
556k
            {
89
556k
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
556k
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
556k
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
556k
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
556k
#define PASTE(x, y) x ## y
90
556k
                f(*it->callbacks);
91
556k
            }
92
556k
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
556k
        }
94
556k
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::BlockConnected(kernel::ChainstateRole const&, std::shared_ptr<CBlock const>, CBlockIndex const*)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::BlockConnected(kernel::ChainstateRole const&, std::shared_ptr<CBlock const>, CBlockIndex const*)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
Line
Count
Source
84
30.1M
    {
85
30.1M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.1M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.1M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
60.0M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
29.9M
            ++it->count;
88
29.9M
            {
89
29.9M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
90
29.9M
                f(*it->callbacks);
91
29.9M
            }
92
29.9M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
29.9M
        }
94
30.1M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::MempoolTransactionsRemovedForBlock(std::vector<RemovedMempoolTransactionInfo, std::allocator<RemovedMempoolTransactionInfo>> const&, unsigned int)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::MempoolTransactionsRemovedForBlock(std::vector<RemovedMempoolTransactionInfo, std::allocator<RemovedMempoolTransactionInfo>> const&, unsigned int)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
Line
Count
Source
84
30.1M
    {
85
30.1M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.1M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.1M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
60.0M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
29.9M
            ++it->count;
88
29.9M
            {
89
29.9M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
90
29.9M
                f(*it->callbacks);
91
29.9M
            }
92
29.9M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
29.9M
        }
94
30.1M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::BlockDisconnected(std::shared_ptr<CBlock const>, CBlockIndex const*)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::BlockDisconnected(std::shared_ptr<CBlock const>, CBlockIndex const*)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
Line
Count
Source
84
26.9k
    {
85
26.9k
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
26.9k
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
26.9k
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
53.8k
        for (auto it = m_list.begin(); it != m_list.end();) {
87
26.9k
            ++it->count;
88
26.9k
            {
89
26.9k
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
26.9k
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
26.9k
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
26.9k
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
26.9k
#define PASTE(x, y) x ## y
90
26.9k
                f(*it->callbacks);
91
26.9k
            }
92
26.9k
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
26.9k
        }
94
26.9k
    }
Unexecuted instantiation: validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::ChainStateFlushed(kernel::ChainstateRole const&, CBlockLocator const&)::$_0::operator()() const::'lambda'(CValidationInterface&)>(ValidationSignals::ChainStateFlushed(kernel::ChainstateRole const&, CBlockLocator const&)::$_0::operator()() const::'lambda'(CValidationInterface&)&&)
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::BlockChecked(std::shared_ptr<CBlock const> const&, BlockValidationState const&)::$_0>(ValidationSignals::BlockChecked(std::shared_ptr<CBlock const> const&, BlockValidationState const&)::$_0&&)
Line
Count
Source
84
30.1M
    {
85
30.1M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
30.1M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
30.1M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
60.1M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
29.9M
            ++it->count;
88
29.9M
            {
89
29.9M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.9M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.9M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.9M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.9M
#define PASTE(x, y) x ## y
90
29.9M
                f(*it->callbacks);
91
29.9M
            }
92
29.9M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
29.9M
        }
94
30.1M
    }
validationinterface.cpp:void ValidationSignalsImpl::Iterate<ValidationSignals::NewPoWValidBlock(CBlockIndex const*, std::shared_ptr<CBlock const> const&)::$_0>(ValidationSignals::NewPoWValidBlock(CBlockIndex const*, std::shared_ptr<CBlock const> const&)::$_0&&)
Line
Count
Source
84
29.8M
    {
85
29.8M
        WAIT_LOCK(m_mutex, lock);
Line
Count
Source
274
29.8M
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
Line
Count
Source
272
29.8M
#define LOCK_ARGS(cs) MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__
86
59.6M
        for (auto it = m_list.begin(); it != m_list.end();) {
87
29.8M
            ++it->count;
88
29.8M
            {
89
29.8M
                REVERSE_LOCK(lock, m_mutex);
Line
Count
Source
254
29.8M
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
Line
Count
Source
11
29.8M
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
Line
Count
Source
9
29.8M
#define PASTE2(x, y) PASTE(x, y)
Line
Count
Source
8
29.8M
#define PASTE(x, y) x ## y
90
29.8M
                f(*it->callbacks);
91
29.8M
            }
92
29.8M
            it = --it->count ? std::next(it) : 
m_list.erase(it)0
;
93
29.8M
        }
94
29.8M
    }
95
};
96
97
ValidationSignals::ValidationSignals(std::unique_ptr<util::TaskRunnerInterface> task_runner)
98
0
    : m_internals{std::make_unique<ValidationSignalsImpl>(std::move(task_runner))} {}
99
100
1
ValidationSignals::~ValidationSignals() = default;
101
102
void ValidationSignals::FlushBackgroundCallbacks()
103
1
{
104
1
    m_internals->m_task_runner->flush();
105
1
}
106
107
size_t ValidationSignals::CallbacksPending()
108
30.1M
{
109
30.1M
    return m_internals->m_task_runner->size();
110
30.1M
}
111
112
void ValidationSignals::RegisterSharedValidationInterface(std::shared_ptr<CValidationInterface> callbacks)
113
29.7M
{
114
    // Each connection captures the shared_ptr to ensure that each callback is
115
    // executed before the subscriber is destroyed. For more details see #18338.
116
29.7M
    m_internals->Register(std::move(callbacks));
117
29.7M
}
118
119
void ValidationSignals::RegisterValidationInterface(CValidationInterface* callbacks)
120
29.7M
{
121
    // Create a shared_ptr with a no-op deleter - CValidationInterface lifecycle
122
    // is managed by the caller.
123
29.7M
    RegisterSharedValidationInterface({callbacks, [](CValidationInterface*){}});
124
29.7M
}
125
126
void ValidationSignals::UnregisterSharedValidationInterface(std::shared_ptr<CValidationInterface> callbacks)
127
0
{
128
0
    UnregisterValidationInterface(callbacks.get());
129
0
}
130
131
void ValidationSignals::UnregisterValidationInterface(CValidationInterface* callbacks)
132
29.5M
{
133
29.5M
    m_internals->Unregister(callbacks);
134
29.5M
}
135
136
void ValidationSignals::UnregisterAllValidationInterfaces()
137
190k
{
138
190k
    m_internals->Clear();
139
190k
}
140
141
void ValidationSignals::CallFunctionInValidationInterfaceQueue(std::function<void()> func)
142
29.9M
{
143
29.9M
    m_internals->m_task_runner->insert(std::move(func));
144
29.9M
}
145
146
void ValidationSignals::SyncWithValidationInterfaceQueue()
147
29.9M
{
148
29.9M
    AssertLockNotHeld(cs_main);
Line
Count
Source
149
29.9M
#define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, __LINE__, &cs)
149
    // Block until the validation queue drains
150
29.9M
    std::promise<void> promise;
151
29.9M
    CallFunctionInValidationInterfaceQueue([&promise] {
152
29.9M
        promise.set_value();
153
29.9M
    });
154
29.9M
    promise.get_future().wait();
155
29.9M
}
156
157
// Use a macro instead of a function for conditional logging to prevent
158
// evaluating arguments when logging is not enabled.
159
#define ENQUEUE_AND_LOG_EVENT(event, log_msg)                                                                    \
160
91.9M
    do {                                                                                                         \
161
91.9M
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
91.9M
                      "event must be passed as an rvalue");                                                      \
163
91.9M
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
91.9M
                      "log_msg must be passed as an rvalue");                                                    \
165
91.9M
        auto enqueue_log_msg = (log_msg);                                                                        \
166
91.9M
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
167
91.9M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
91.9M
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
30.0M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.0M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.0M
    do {                                                               \
109
30.0M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.0M
    } while (0)
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
1.03M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
1.03M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
1.03M
    do {                                                               \
109
1.03M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
1.03M
    } while (0)
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
556k
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
556k
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
556k
    do {                                                               \
109
556k
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
556k
    } while (0)
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
26.9k
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
26.9k
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
26.9k
    do {                                                               \
109
26.9k
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
26.9k
    } while (0)
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
0
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
0
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
0
    do {                                                               \
109
0
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
0
    } while (0)
169
91.9M
            local_event();                                                                                       \
170
91.9M
        });                                                                                                      \
validationinterface.cpp:ValidationSignals::UpdatedBlockTip(CBlockIndex const*, CBlockIndex const*, bool)::$_1::operator()() const
Line
Count
Source
167
30.0M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
30.0M
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
30.0M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.0M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.0M
    do {                                                               \
109
30.0M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.0M
    } while (0)
169
30.0M
            local_event();                                                                                       \
170
30.0M
        });                                                                                                      \
validationinterface.cpp:ValidationSignals::TransactionAddedToMempool(NewMempoolTransactionInfo const&, unsigned long)::$_1::operator()() const
Line
Count
Source
167
1.03M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
1.03M
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
1.03M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
1.03M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
1.03M
    do {                                                               \
109
1.03M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
1.03M
    } while (0)
169
1.03M
            local_event();                                                                                       \
170
1.03M
        });                                                                                                      \
validationinterface.cpp:ValidationSignals::TransactionRemovedFromMempool(std::shared_ptr<CTransaction const> const&, MemPoolRemovalReason, unsigned long)::$_1::operator()() const
Line
Count
Source
167
556k
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
556k
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
556k
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
556k
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
556k
    do {                                                               \
109
556k
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
556k
    } while (0)
169
556k
            local_event();                                                                                       \
170
556k
        });                                                                                                      \
validationinterface.cpp:ValidationSignals::BlockConnected(kernel::ChainstateRole const&, std::shared_ptr<CBlock const>, CBlockIndex const*)::$_1::operator()() const
Line
Count
Source
167
30.1M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
30.1M
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
169
30.1M
            local_event();                                                                                       \
170
30.1M
        });                                                                                                      \
validationinterface.cpp:ValidationSignals::MempoolTransactionsRemovedForBlock(std::vector<RemovedMempoolTransactionInfo, std::allocator<RemovedMempoolTransactionInfo>> const&, unsigned int)::$_1::operator()() const
Line
Count
Source
167
30.1M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
30.1M
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
169
30.1M
            local_event();                                                                                       \
170
30.1M
        });                                                                                                      \
validationinterface.cpp:ValidationSignals::BlockDisconnected(std::shared_ptr<CBlock const>, CBlockIndex const*)::$_1::operator()() const
Line
Count
Source
167
26.9k
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
26.9k
            LOG_EVENT("%s", local_log_msg);                                                                      \
Line
Count
Source
177
26.9k
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
26.9k
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
26.9k
    do {                                                               \
109
26.9k
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
26.9k
    } while (0)
169
26.9k
            local_event();                                                                                       \
170
26.9k
        });                                                                                                      \
Unexecuted instantiation: validationinterface.cpp:ValidationSignals::ChainStateFlushed(kernel::ChainstateRole const&, CBlockLocator const&)::$_1::operator()() const
171
91.9M
    } while (0)
172
173
#define LOG_MSG(fmt, ...) \
174
91.9M
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), 0
__VA_ARGS__0
) : std::string{})
175
176
#define LOG_EVENT(fmt, ...) \
177
273M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
178
179
30.0M
void ValidationSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {
180
    // Dependencies exist that require UpdatedBlockTip events to be delivered in the order in which
181
    // the chain actually updates. One way to ensure this is for the caller to invoke this signal
182
    // in the same critical section where the chain is updated
183
184
30.0M
    auto log_msg = LOG_MSG("%s: new block hash=%s fork block hash=%s (in IBD=%s)", __func__,
Line
Count
Source
174
30.0M
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), 0
__VA_ARGS__0
) : std::string{})
185
30.0M
                          pindexNew->GetBlockHash().ToString(),
186
30.0M
                          pindexFork ? pindexFork->GetBlockHash().ToString() : "null",
187
30.0M
                          fInitialDownload);
188
30.0M
    auto event = [pindexNew, pindexFork, fInitialDownload, this] {
189
30.0M
        m_internals->Iterate([&](CValidationInterface& callbacks) 
{ callbacks.UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload); }29.9M
);
190
30.0M
    };
191
30.0M
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
30.0M
    do {                                                                                                         \
161
30.0M
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
30.0M
                      "event must be passed as an rvalue");                                                      \
163
30.0M
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
30.0M
                      "log_msg must be passed as an rvalue");                                                    \
165
30.0M
        auto enqueue_log_msg = (log_msg);                                                                        \
166
30.0M
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
30.0M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.0M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.0M
    do {                                                               \
109
30.0M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.0M
    } while (0)
167
30.0M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
30.0M
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
30.0M
            local_event();                                                                                       \
170
30.0M
        });                                                                                                      \
171
30.0M
    } while (0)
192
30.0M
}
193
194
void ValidationSignals::ActiveTipChange(const CBlockIndex& new_tip, bool is_ibd)
195
30.0M
{
196
30.0M
    LOG_EVENT("%s: new block hash=%s block height=%d", __func__, new_tip.GetBlockHash().ToString(), new_tip.nHeight);
Line
Count
Source
177
30.0M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.0M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.0M
    do {                                                               \
109
30.0M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.0M
    } while (0)
197
30.0M
    m_internals->Iterate([&](CValidationInterface& callbacks) 
{ callbacks.ActiveTipChange(new_tip, is_ibd); }29.9M
);
198
30.0M
}
199
200
void ValidationSignals::TransactionAddedToMempool(const NewMempoolTransactionInfo& tx, uint64_t mempool_sequence)
201
1.03M
{
202
1.03M
    auto log_msg = LOG_MSG("%s: txid=%s wtxid=%s", __func__,
Line
Count
Source
174
1.03M
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), __VA_ARGS__)0
: std::string{})
203
1.03M
                          tx.info.m_tx->GetHash().ToString(),
204
1.03M
                          tx.info.m_tx->GetWitnessHash().ToString());
205
1.03M
    auto event = [tx, mempool_sequence, this] {
206
1.03M
        m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.TransactionAddedToMempool(tx, mempool_sequence); });
207
1.03M
    };
208
1.03M
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
1.03M
    do {                                                                                                         \
161
1.03M
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
1.03M
                      "event must be passed as an rvalue");                                                      \
163
1.03M
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
1.03M
                      "log_msg must be passed as an rvalue");                                                    \
165
1.03M
        auto enqueue_log_msg = (log_msg);                                                                        \
166
1.03M
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
1.03M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
1.03M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
1.03M
    do {                                                               \
109
1.03M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
1.03M
    } while (0)
167
1.03M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
1.03M
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
1.03M
            local_event();                                                                                       \
170
1.03M
        });                                                                                                      \
171
1.03M
    } while (0)
209
1.03M
}
210
211
556k
void ValidationSignals::TransactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) {
212
556k
    auto log_msg = LOG_MSG("%s: txid=%s wtxid=%s reason=%s", __func__,
Line
Count
Source
174
556k
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), __VA_ARGS__)0
: std::string{})
213
556k
                          tx->GetHash().ToString(),
214
556k
                          tx->GetWitnessHash().ToString(),
215
556k
                          RemovalReasonToString(reason));
216
556k
    auto event = [tx, reason, mempool_sequence, this] {
217
556k
        m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.TransactionRemovedFromMempool(tx, reason, mempool_sequence); });
218
556k
    };
219
556k
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
556k
    do {                                                                                                         \
161
556k
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
556k
                      "event must be passed as an rvalue");                                                      \
163
556k
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
556k
                      "log_msg must be passed as an rvalue");                                                    \
165
556k
        auto enqueue_log_msg = (log_msg);                                                                        \
166
556k
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
556k
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
556k
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
556k
    do {                                                               \
109
556k
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
556k
    } while (0)
167
556k
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
556k
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
556k
            local_event();                                                                                       \
170
556k
        });                                                                                                      \
171
556k
    } while (0)
220
556k
}
221
222
void ValidationSignals::BlockConnected(const ChainstateRole& role, std::shared_ptr<const CBlock> pblock, const CBlockIndex* pindex)
223
30.1M
{
224
30.1M
    auto log_msg = LOG_MSG("%s: block hash=%s block height=%d", __func__,
Line
Count
Source
174
30.1M
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), __VA_ARGS__)0
: std::string{})
225
30.1M
                          pblock->GetHash().ToString(),
226
30.1M
                          pindex->nHeight);
227
30.1M
    auto event = [role, pblock = std::move(pblock), pindex, this] {
228
30.1M
        m_internals->Iterate([&](CValidationInterface& callbacks) 
{ callbacks.BlockConnected(role, pblock, pindex); }29.9M
);
229
30.1M
    };
230
30.1M
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
30.1M
    do {                                                                                                         \
161
30.1M
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
30.1M
                      "event must be passed as an rvalue");                                                      \
163
30.1M
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
30.1M
                      "log_msg must be passed as an rvalue");                                                    \
165
30.1M
        auto enqueue_log_msg = (log_msg);                                                                        \
166
30.1M
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
167
30.1M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
30.1M
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
30.1M
            local_event();                                                                                       \
170
30.1M
        });                                                                                                      \
171
30.1M
    } while (0)
231
30.1M
}
232
233
void ValidationSignals::MempoolTransactionsRemovedForBlock(const std::vector<RemovedMempoolTransactionInfo>& txs_removed_for_block, unsigned int nBlockHeight)
234
30.1M
{
235
30.1M
    auto log_msg = LOG_MSG("%s: block height=%s txs removed=%s", __func__,
Line
Count
Source
174
30.1M
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), __VA_ARGS__)0
: std::string{})
236
30.1M
                          nBlockHeight,
237
30.1M
                          txs_removed_for_block.size());
238
30.1M
    auto event = [txs_removed_for_block, nBlockHeight, this] {
239
30.1M
        m_internals->Iterate([&](CValidationInterface& callbacks) 
{ callbacks.MempoolTransactionsRemovedForBlock(txs_removed_for_block, nBlockHeight); }29.9M
);
240
30.1M
    };
241
30.1M
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
30.1M
    do {                                                                                                         \
161
30.1M
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
30.1M
                      "event must be passed as an rvalue");                                                      \
163
30.1M
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
30.1M
                      "log_msg must be passed as an rvalue");                                                    \
165
30.1M
        auto enqueue_log_msg = (log_msg);                                                                        \
166
30.1M
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
167
30.1M
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
30.1M
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
30.1M
            local_event();                                                                                       \
170
30.1M
        });                                                                                                      \
171
30.1M
    } while (0)
242
30.1M
}
243
244
void ValidationSignals::BlockDisconnected(std::shared_ptr<const CBlock> pblock, const CBlockIndex* pindex)
245
26.9k
{
246
26.9k
    auto log_msg = LOG_MSG("%s: block hash=%s block height=%d", __func__,
Line
Count
Source
174
26.9k
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? 
tfm::format((fmt), __VA_ARGS__)0
: std::string{})
247
26.9k
                          pblock->GetHash().ToString(),
248
26.9k
                          pindex->nHeight);
249
26.9k
    auto event = [pblock = std::move(pblock), pindex, this] {
250
26.9k
        m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.BlockDisconnected(pblock, pindex); });
251
26.9k
    };
252
26.9k
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
26.9k
    do {                                                                                                         \
161
26.9k
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
26.9k
                      "event must be passed as an rvalue");                                                      \
163
26.9k
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
26.9k
                      "log_msg must be passed as an rvalue");                                                    \
165
26.9k
        auto enqueue_log_msg = (log_msg);                                                                        \
166
26.9k
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
26.9k
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
26.9k
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
26.9k
    do {                                                               \
109
26.9k
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
26.9k
    } while (0)
167
26.9k
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
26.9k
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
26.9k
            local_event();                                                                                       \
170
26.9k
        });                                                                                                      \
171
26.9k
    } while (0)
253
26.9k
}
254
255
void ValidationSignals::ChainStateFlushed(const ChainstateRole& role, const CBlockLocator& locator)
256
0
{
257
0
    auto log_msg = LOG_MSG("%s: block hash=%s", __func__,
Line
Count
Source
174
0
    (ShouldLog(BCLog::VALIDATION, BCLog::Level::Debug) ? tfm::format((fmt), __VA_ARGS__) : std::string{})
258
0
                          locator.IsNull() ? "null" : locator.vHave.front().ToString());
259
0
    auto event = [role, locator, this] {
260
0
        m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.ChainStateFlushed(role, locator); });
261
0
    };
262
0
    ENQUEUE_AND_LOG_EVENT(std::move(event), std::move(log_msg));
Line
Count
Source
160
0
    do {                                                                                                         \
161
0
        static_assert(std::is_rvalue_reference_v<decltype((event))>,                                             \
162
0
                      "event must be passed as an rvalue");                                                      \
163
0
        static_assert(std::is_rvalue_reference_v<decltype((log_msg))>,                                           \
164
0
                      "log_msg must be passed as an rvalue");                                                    \
165
0
        auto enqueue_log_msg = (log_msg);                                                                        \
166
0
        LOG_EVENT("Enqueuing %s", enqueue_log_msg);                                                              \
Line
Count
Source
177
0
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
0
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
0
    do {                                                               \
109
0
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
0
    } while (0)
167
0
        m_internals->m_task_runner->insert([local_log_msg = std::move(enqueue_log_msg), local_event = (event)] { \
168
0
            LOG_EVENT("%s", local_log_msg);                                                                      \
169
0
            local_event();                                                                                       \
170
0
        });                                                                                                      \
171
0
    } while (0)
263
0
}
264
265
void ValidationSignals::BlockChecked(const std::shared_ptr<const CBlock>& block, const BlockValidationState& state)
266
30.1M
{
267
30.1M
    LOG_EVENT("%s: block hash=%s state=%s", __func__,
Line
Count
Source
177
30.1M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
30.1M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
30.1M
    do {                                                               \
109
30.1M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
30.1M
    } while (0)
268
30.1M
              block->GetHash().ToString(), state.ToString());
269
30.1M
    m_internals->Iterate([&](CValidationInterface& callbacks) 
{ callbacks.BlockChecked(block, state); }29.9M
);
270
30.1M
}
271
272
29.8M
void ValidationSignals::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock> &block) {
273
29.8M
    LOG_EVENT("%s: block hash=%s", __func__, block->GetHash().ToString());
Line
Count
Source
177
29.8M
    LogDebug(BCLog::VALIDATION, fmt, __VA_ARGS__)
Line
Count
Source
117
29.8M
#define LogDebug(category, ...) detail_LogIfCategoryAndLevelEnabled(category, BCLog::Level::Debug, __VA_ARGS__)
Line
Count
Source
108
29.8M
    do {                                                               \
109
29.8M
        if (util::log::ShouldLog((category), (level))) {               \
110
0
            bool rate_limit{level >= BCLog::Level::Info};              \
111
0
            Assume(!rate_limit); /*Only called with the levels below*/ \
Line
Count
Source
125
0
#define Assume(val) inline_assertion_check<false>(val, std::source_location::current(), #val)
112
0
            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);  \
Line
Count
Source
91
0
#define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__)
113
0
        }                                                              \
114
29.8M
    } while (0)
274
29.8M
    m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NewPoWValidBlock(pindex, block); });
275
29.8M
}