LCOV - code coverage report
Current view: top level - src/node - kernel_notifications.h (source / functions) Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 100.0 % 3 3
Test Date: 2024-08-28 04:44:32 Functions: - 0 0
Branches: 50.0 % 8 4

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2023 The Bitcoin Core developers
       2                 :             : // Distributed under the MIT software license, see the accompanying
       3                 :             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :             : 
       5                 :             : #ifndef BITCOIN_NODE_KERNEL_NOTIFICATIONS_H
       6                 :             : #define BITCOIN_NODE_KERNEL_NOTIFICATIONS_H
       7                 :             : 
       8                 :             : #include <kernel/notifications_interface.h>
       9                 :             : 
      10                 :             : #include <atomic>
      11                 :             : #include <cstdint>
      12                 :             : 
      13                 :             : class ArgsManager;
      14                 :             : class CBlockIndex;
      15                 :             : enum class SynchronizationState;
      16                 :             : struct bilingual_str;
      17                 :             : 
      18                 :             : namespace kernel {
      19                 :             : enum class Warning;
      20                 :             : } // namespace kernel
      21                 :             : 
      22                 :             : namespace util {
      23                 :             : class SignalInterrupt;
      24                 :             : } // namespace util
      25                 :             : 
      26                 :             : namespace node {
      27                 :             : 
      28                 :             : class Warnings;
      29                 :             : static constexpr int DEFAULT_STOPATHEIGHT{0};
      30                 :             : 
      31                 :           2 : class KernelNotifications : public kernel::Notifications
      32                 :             : {
      33                 :             : public:
      34                 :         171 :     KernelNotifications(util::SignalInterrupt& shutdown, std::atomic<int>& exit_status, node::Warnings& warnings)
      35   [ +  -  +  -  :         173 :         : m_shutdown(shutdown), m_exit_status{exit_status}, m_warnings{warnings} {}
             +  -  +  - ]
      36                 :             : 
      37                 :             :     [[nodiscard]] kernel::InterruptResult blockTip(SynchronizationState state, CBlockIndex& index) override;
      38                 :             : 
      39                 :             :     void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) override;
      40                 :             : 
      41                 :             :     void progress(const bilingual_str& title, int progress_percent, bool resume_possible) override;
      42                 :             : 
      43                 :             :     void warningSet(kernel::Warning id, const bilingual_str& message) override;
      44                 :             : 
      45                 :             :     void warningUnset(kernel::Warning id) override;
      46                 :             : 
      47                 :             :     void flushError(const bilingual_str& message) override;
      48                 :             : 
      49                 :             :     void fatalError(const bilingual_str& message) override;
      50                 :             : 
      51                 :             :     //! Block height after which blockTip notification will return Interrupted{}, if >0.
      52                 :             :     int m_stop_at_height{DEFAULT_STOPATHEIGHT};
      53                 :             :     //! Useful for tests, can be set to false to avoid shutdown on fatal error.
      54                 :             :     bool m_shutdown_on_fatal_error{true};
      55                 :             : private:
      56                 :             :     util::SignalInterrupt& m_shutdown;
      57                 :             :     std::atomic<int>& m_exit_status;
      58                 :             :     node::Warnings& m_warnings;
      59                 :             : };
      60                 :             : 
      61                 :             : void ReadNotificationArgs(const ArgsManager& args, KernelNotifications& notifications);
      62                 :             : 
      63                 :             : } // namespace node
      64                 :             : 
      65                 :             : #endif // BITCOIN_NODE_KERNEL_NOTIFICATIONS_H
        

Generated by: LCOV version 2.0-1