diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-05-10 22:29:17 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-05-20 12:03:22 +0200 |
commit | 447761c8228d58f948aae7e73ed079c028cacb97 (patch) | |
tree | 138ae285148636dd18870df62338a6acacaa400c /src/kernel/notifications_interface.h | |
parent | 0f8c95dccd120ad5fd371f81025137b855796f13 (diff) | |
download | bitcoin-447761c8228d58f948aae7e73ed079c028cacb97.tar.xz |
kernel: Add notification interface
This commit is part of the libbitcoinkernel project and seeks to remove
the ChainstateManager's and, more generally, the kernel library's
dependency on interface_ui with options methods in this and the following
few commits. By removing interface_ui from the kernel library, its
dependency on boost is reduced to just boost::multi_index.
Define a new kernel notification class with virtual methods for
notifying about internal kernel events. Create a new file in the node
library for defining a function creating the default set of notification
methods such that these do not need to be re-defined all over the
codebase. As a first step, add a `blockTip` method, wrapping
`uiInterface.NotifyBlockTip`.
Diffstat (limited to 'src/kernel/notifications_interface.h')
-rw-r--r-- | src/kernel/notifications_interface.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/kernel/notifications_interface.h b/src/kernel/notifications_interface.h new file mode 100644 index 0000000000..d90284fbea --- /dev/null +++ b/src/kernel/notifications_interface.h @@ -0,0 +1,26 @@ +// Copyright (c) 2023 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H +#define BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H + +class CBlockIndex; +enum class SynchronizationState; + +namespace kernel { + +/** + * A base class defining functions for notifying about certain kernel + * events. + */ +class Notifications +{ +public: + virtual ~Notifications(){}; + + virtual void blockTip(SynchronizationState state, CBlockIndex& index) {} +}; +} // namespace kernel + +#endif // BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H |