Skip to content

Commit 75d9b72

Browse files
committed
kernel: make blockTip index const
Notification interface subscribers need to view, but not mutate, the index.
1 parent 37c21eb commit 75d9b72

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/bitcoin-chainstate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
7474
class KernelNotifications : public kernel::Notifications
7575
{
7676
public:
77-
kernel::InterruptResult blockTip(SynchronizationState, CBlockIndex&, double) override
77+
kernel::InterruptResult blockTip(SynchronizationState, const CBlockIndex&, double) override
7878
{
7979
std::cout << "Block tip changed" << std::endl;
8080
return {};

src/kernel/notifications_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Notifications
3737
public:
3838
virtual ~Notifications() = default;
3939

40-
[[nodiscard]] virtual InterruptResult blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress) { return {}; }
40+
[[nodiscard]] virtual InterruptResult blockTip(SynchronizationState state, const CBlockIndex& index, double verification_progress) { return {}; }
4141
virtual void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) {}
4242
virtual void progress(const bilingual_str& title, int progress_percent, bool resume_possible) {}
4343
virtual void warningSet(Warning id, const bilingual_str& message) {}

src/node/kernel_notifications.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void AlertNotify(const std::string& strMessage)
4848

4949
namespace node {
5050

51-
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress)
51+
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, const CBlockIndex& index, double verification_progress)
5252
{
5353
{
5454
LOCK(m_tip_block_mutex);

src/node/kernel_notifications.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class KernelNotifications : public kernel::Notifications
3535
KernelNotifications(const std::function<bool()>& shutdown_request, std::atomic<int>& exit_status, node::Warnings& warnings)
3636
: m_shutdown_request(shutdown_request), m_exit_status{exit_status}, m_warnings{warnings} {}
3737

38-
[[nodiscard]] kernel::InterruptResult blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress) override EXCLUSIVE_LOCKS_REQUIRED(!m_tip_block_mutex);
38+
[[nodiscard]] kernel::InterruptResult blockTip(SynchronizationState state, const CBlockIndex& index, double verification_progress) override EXCLUSIVE_LOCKS_REQUIRED(!m_tip_block_mutex);
3939

4040
void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) override;
4141

0 commit comments

Comments
 (0)