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