mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Merge bitcoin/bitcoin#33321: kernel: make blockTip index const
75d9b72475kernel: make blockTip index const (stickies-v) Pull request description: Notification interface subscribers need to view, but not mutate, the index. This change allows improving the #30595 kernel interface, see e.g. `BlockTreeEntry` where [currently](https://github.com/bitcoin/bitcoin/pull/30595/files#diff-4d05cd02fdce641be603f0f9abcecfeaf76944285d4539ba4bbc40337fa9bbc2R617) a `View` is constructed from a non-const pointer, whereas really this should be a `const btck_BlockTreeEntry* entry`. ACKs for top commit: achow101: ACK75d9b72475TheCharlatan: ACK75d9b72475l0rinc: Code review ACK75d9b72475yuvicc: Code review ACK75d9b72475Tree-SHA512: 6151374a040cead36490c5fa5ce9dc4d93499a02110f444c50bd90f9095912747bc5b2fd7294815e6794c96a6843f43eb0507706d41d7296af96071b5f704ff4
This commit is contained in:
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
|
||||
class KernelNotifications : public kernel::Notifications
|
||||
{
|
||||
public:
|
||||
kernel::InterruptResult blockTip(SynchronizationState, CBlockIndex&, double) override
|
||||
kernel::InterruptResult blockTip(SynchronizationState, const CBlockIndex&, double) override
|
||||
{
|
||||
std::cout << "Block tip changed" << std::endl;
|
||||
return {};
|
||||
|
||||
@@ -37,7 +37,7 @@ class Notifications
|
||||
public:
|
||||
virtual ~Notifications() = default;
|
||||
|
||||
[[nodiscard]] virtual InterruptResult blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress) { return {}; }
|
||||
[[nodiscard]] virtual InterruptResult blockTip(SynchronizationState state, const CBlockIndex& index, double verification_progress) { return {}; }
|
||||
virtual void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) {}
|
||||
virtual void progress(const bilingual_str& title, int progress_percent, bool resume_possible) {}
|
||||
virtual void warningSet(Warning id, const bilingual_str& message) {}
|
||||
|
||||
@@ -48,7 +48,7 @@ static void AlertNotify(const std::string& strMessage)
|
||||
|
||||
namespace node {
|
||||
|
||||
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress)
|
||||
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, const CBlockIndex& index, double verification_progress)
|
||||
{
|
||||
{
|
||||
LOCK(m_tip_block_mutex);
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
KernelNotifications(const std::function<bool()>& shutdown_request, std::atomic<int>& exit_status, node::Warnings& warnings)
|
||||
: m_shutdown_request(shutdown_request), m_exit_status{exit_status}, m_warnings{warnings} {}
|
||||
|
||||
[[nodiscard]] kernel::InterruptResult blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress) override EXCLUSIVE_LOCKS_REQUIRED(!m_tip_block_mutex);
|
||||
[[nodiscard]] kernel::InterruptResult blockTip(SynchronizationState state, const CBlockIndex& index, double verification_progress) override EXCLUSIVE_LOCKS_REQUIRED(!m_tip_block_mutex);
|
||||
|
||||
void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user