From 65fba1e2f379667ae58da8d3301881d55d6fd3e8 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 16 May 2026 11:20:01 -0400 Subject: [PATCH 1/2] Rename handle_event to handle_chase (name conflict). --- include/bitcoin/node/chasers/chaser_check.hpp | 2 +- include/bitcoin/node/chasers/chaser_confirm.hpp | 2 +- include/bitcoin/node/chasers/chaser_organize.hpp | 2 +- include/bitcoin/node/chasers/chaser_snapshot.hpp | 2 +- include/bitcoin/node/chasers/chaser_storage.hpp | 2 +- include/bitcoin/node/chasers/chaser_template.hpp | 2 +- include/bitcoin/node/chasers/chaser_transaction.hpp | 2 +- include/bitcoin/node/chasers/chaser_validate.hpp | 2 +- include/bitcoin/node/impl/chasers/chaser_organize.ipp | 4 ++-- include/bitcoin/node/protocols/protocol_block_in_31800.hpp | 2 +- include/bitcoin/node/protocols/protocol_block_out_106.hpp | 2 +- .../bitcoin/node/protocols/protocol_header_out_70012.hpp | 2 +- include/bitcoin/node/protocols/protocol_observer.hpp | 2 +- .../bitcoin/node/protocols/protocol_transaction_out_106.hpp | 2 +- src/chasers/chaser_check.cpp | 4 ++-- src/chasers/chaser_confirm.cpp | 6 +++--- src/chasers/chaser_snapshot.cpp | 4 ++-- src/chasers/chaser_storage.cpp | 4 ++-- src/chasers/chaser_template.cpp | 4 ++-- src/chasers/chaser_transaction.cpp | 4 ++-- src/chasers/chaser_validate.cpp | 6 +++--- src/protocols/protocol_block_in_31800.cpp | 4 ++-- src/protocols/protocol_block_out_106.cpp | 4 ++-- src/protocols/protocol_header_out_70012.cpp | 4 ++-- src/protocols/protocol_observer.cpp | 4 ++-- src/protocols/protocol_transaction_out_106.cpp | 4 ++-- 26 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/bitcoin/node/chasers/chaser_check.hpp b/include/bitcoin/node/chasers/chaser_check.hpp index d27025a7..dc3b9768 100644 --- a/include/bitcoin/node/chasers/chaser_check.hpp +++ b/include/bitcoin/node/chasers/chaser_check.hpp @@ -60,7 +60,7 @@ class BCN_API chaser_check protected: virtual void handle_purged(const code& ec) NOEXCEPT; - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; /// block tracking diff --git a/include/bitcoin/node/chasers/chaser_confirm.hpp b/include/bitcoin/node/chasers/chaser_confirm.hpp index a8936cad..798c5607 100644 --- a/include/bitcoin/node/chasers/chaser_confirm.hpp +++ b/include/bitcoin/node/chasers/chaser_confirm.hpp @@ -43,7 +43,7 @@ class BCN_API chaser_confirm using header_links = database::header_links; using header_states = database::header_states; - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; virtual void do_regressed(height_t branch_point) NOEXCEPT; diff --git a/include/bitcoin/node/chasers/chaser_organize.hpp b/include/bitcoin/node/chasers/chaser_organize.hpp index 53ca06fa..98a7d5e4 100644 --- a/include/bitcoin/node/chasers/chaser_organize.hpp +++ b/include/bitcoin/node/chasers/chaser_organize.hpp @@ -86,7 +86,7 @@ class chaser_organize /// ----------------------------------------------------------------------- /// Handle chaser events. - virtual bool handle_event(const code&, chase event_, + virtual bool handle_chase(const code&, chase event_, event_value value) NOEXCEPT; /// Organize a discovered Block. diff --git a/include/bitcoin/node/chasers/chaser_snapshot.hpp b/include/bitcoin/node/chasers/chaser_snapshot.hpp index fd0c03dc..5b0d9ca8 100644 --- a/include/bitcoin/node/chasers/chaser_snapshot.hpp +++ b/include/bitcoin/node/chasers/chaser_snapshot.hpp @@ -46,7 +46,7 @@ class BCN_API chaser_snapshot ////virtual void do_valid(height_t height) NOEXCEPT; ////virtual void do_confirm(height_t height) NOEXCEPT; - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; private: diff --git a/include/bitcoin/node/chasers/chaser_storage.hpp b/include/bitcoin/node/chasers/chaser_storage.hpp index ba05df37..77645b53 100644 --- a/include/bitcoin/node/chasers/chaser_storage.hpp +++ b/include/bitcoin/node/chasers/chaser_storage.hpp @@ -43,7 +43,7 @@ class BCN_API chaser_storage protected: virtual void do_reload() NOEXCEPT; virtual void do_space(size_t space) NOEXCEPT; - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; private: diff --git a/include/bitcoin/node/chasers/chaser_template.hpp b/include/bitcoin/node/chasers/chaser_template.hpp index b3405155..4ee2099d 100644 --- a/include/bitcoin/node/chasers/chaser_template.hpp +++ b/include/bitcoin/node/chasers/chaser_template.hpp @@ -39,7 +39,7 @@ class BCN_API chaser_template code start() NOEXCEPT override; protected: - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; virtual void do_transaction(transaction_t value) NOEXCEPT; diff --git a/include/bitcoin/node/chasers/chaser_transaction.hpp b/include/bitcoin/node/chasers/chaser_transaction.hpp index be84cf6e..a5f43b76 100644 --- a/include/bitcoin/node/chasers/chaser_transaction.hpp +++ b/include/bitcoin/node/chasers/chaser_transaction.hpp @@ -41,7 +41,7 @@ class BCN_API chaser_transaction virtual void store(const system::chain::transaction::cptr& block) NOEXCEPT; protected: - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; virtual void do_confirmed(header_t link) NOEXCEPT; diff --git a/include/bitcoin/node/chasers/chaser_validate.hpp b/include/bitcoin/node/chasers/chaser_validate.hpp index dcc6f0ac..5ba698d2 100644 --- a/include/bitcoin/node/chasers/chaser_validate.hpp +++ b/include/bitcoin/node/chasers/chaser_validate.hpp @@ -52,7 +52,7 @@ class BCN_API chaser_validate typedef network::race_unity race; - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; virtual void do_regressed(height_t branch_point) NOEXCEPT; diff --git a/include/bitcoin/node/impl/chasers/chaser_organize.ipp b/include/bitcoin/node/impl/chasers/chaser_organize.ipp index b831f1d0..b34993de 100644 --- a/include/bitcoin/node/impl/chasers/chaser_organize.ipp +++ b/include/bitcoin/node/impl/chasers/chaser_organize.ipp @@ -61,7 +61,7 @@ code CLASS::start() NOEXCEPT LOGN("Candidate top [" << system::encode_hash(state_->hash()) << ":" << state_->height() << "]."); - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } @@ -79,7 +79,7 @@ void CLASS::organize(const typename Block::cptr& block, // ---------------------------------------------------------------------------- TEMPLATE -bool CLASS::handle_event(const code&, chase event_, event_value value) NOEXCEPT +bool CLASS::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { if (closed()) return false; diff --git a/include/bitcoin/node/protocols/protocol_block_in_31800.hpp b/include/bitcoin/node/protocols/protocol_block_in_31800.hpp index 8d6817de..012a9ffc 100644 --- a/include/bitcoin/node/protocols/protocol_block_in_31800.hpp +++ b/include/bitcoin/node/protocols/protocol_block_in_31800.hpp @@ -60,7 +60,7 @@ class BCN_API protocol_block_in_31800 virtual void do_get_downloads(count_t count) NOEXCEPT; /// Handle chaser events. - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; /// Manage work splitting. diff --git a/include/bitcoin/node/protocols/protocol_block_out_106.hpp b/include/bitcoin/node/protocols/protocol_block_out_106.hpp index 96470554..e65f2c72 100644 --- a/include/bitcoin/node/protocols/protocol_block_out_106.hpp +++ b/include/bitcoin/node/protocols/protocol_block_out_106.hpp @@ -56,7 +56,7 @@ class BCN_API protocol_block_out_106 virtual bool superseded() const NOEXCEPT; /// Handle chaser events. - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; /// Process block announcement. diff --git a/include/bitcoin/node/protocols/protocol_header_out_70012.hpp b/include/bitcoin/node/protocols/protocol_header_out_70012.hpp index 026bb265..1da40d22 100644 --- a/include/bitcoin/node/protocols/protocol_header_out_70012.hpp +++ b/include/bitcoin/node/protocols/protocol_header_out_70012.hpp @@ -47,7 +47,7 @@ class BCN_API protocol_header_out_70012 protected: /// Handle chaser events. - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; /// Process block announcement. diff --git a/include/bitcoin/node/protocols/protocol_observer.hpp b/include/bitcoin/node/protocols/protocol_observer.hpp index c9b810eb..5c89b733 100644 --- a/include/bitcoin/node/protocols/protocol_observer.hpp +++ b/include/bitcoin/node/protocols/protocol_observer.hpp @@ -58,7 +58,7 @@ class BCN_API protocol_observer protected: /// Handle chaser events. - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; /////// Accept incoming get_data message. diff --git a/include/bitcoin/node/protocols/protocol_transaction_out_106.hpp b/include/bitcoin/node/protocols/protocol_transaction_out_106.hpp index 767ecb75..16113766 100644 --- a/include/bitcoin/node/protocols/protocol_transaction_out_106.hpp +++ b/include/bitcoin/node/protocols/protocol_transaction_out_106.hpp @@ -48,7 +48,7 @@ class BCN_API protocol_transaction_out_106 protected: /// Handle chaser events. - virtual bool handle_event(const code& ec, chase event_, + virtual bool handle_chase(const code& ec, chase event_, event_value value) NOEXCEPT; /// Process tx announcement. diff --git a/src/chasers/chaser_check.cpp b/src/chasers/chaser_check.cpp index 79bb704a..291e55dc 100644 --- a/src/chasers/chaser_check.cpp +++ b/src/chasers/chaser_check.cpp @@ -96,7 +96,7 @@ code chaser_check::start() NOEXCEPT const auto added = set_unassociated(); LOGN("Fork point (" << requested_ << ") unassociated (" << added << ")."); - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } @@ -107,7 +107,7 @@ void chaser_check::stopping(const code& ec) NOEXCEPT chaser::stopping(ec); } -bool chaser_check::handle_event(const code&, chase event_, +bool chaser_check::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { if (closed()) diff --git a/src/chasers/chaser_confirm.cpp b/src/chasers/chaser_confirm.cpp index 0f701f18..5fc34a64 100644 --- a/src/chasers/chaser_confirm.cpp +++ b/src/chasers/chaser_confirm.cpp @@ -52,13 +52,13 @@ code chaser_confirm::start() NOEXCEPT if (!defer_) { - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); } return error::success; } -bool chaser_confirm::handle_event(const code&, chase event_, +bool chaser_confirm::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { if (closed()) @@ -276,7 +276,7 @@ void chaser_confirm::organize(header_states& fork, const header_links& popped, // Prevent stall by posting internal event, avoiding external handlers. // Posts new work, preventing recursion and releasing reorganization lock. - handle_event(error::success, chase::bump, height_t{}); + handle_chase(error::success, chase::bump, height_t{}); } bool chaser_confirm::confirm_block(const header_link& link, size_t height, diff --git a/src/chasers/chaser_snapshot.cpp b/src/chasers/chaser_snapshot.cpp index 07bc8f33..08d605e9 100644 --- a/src/chasers/chaser_snapshot.cpp +++ b/src/chasers/chaser_snapshot.cpp @@ -65,14 +65,14 @@ code chaser_snapshot::start() NOEXCEPT ////if (enabled_confirm_) //// confirm_ = std::max(archive().get_top_confirmed(), checkpoint()); - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } // event handlers // ---------------------------------------------------------------------------- -bool chaser_snapshot::handle_event(const code&, chase event_, +bool chaser_snapshot::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { if (closed()) diff --git a/src/chasers/chaser_storage.cpp b/src/chasers/chaser_storage.cpp index 1808e792..20a00ac8 100644 --- a/src/chasers/chaser_storage.cpp +++ b/src/chasers/chaser_storage.cpp @@ -50,7 +50,7 @@ code chaser_storage::start() NOEXCEPT // Construct is too early to create the unstarted timer. disk_timer_ = std::make_shared(log, strand(), seconds{1}); - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } @@ -73,7 +73,7 @@ void chaser_storage::do_stopping(const code&) NOEXCEPT // event handlers // ---------------------------------------------------------------------------- -bool chaser_storage::handle_event(const code&, chase event_, +bool chaser_storage::handle_chase(const code&, chase event_, event_value) NOEXCEPT { if (closed()) diff --git a/src/chasers/chaser_template.cpp b/src/chasers/chaser_template.cpp index 54264567..327836a4 100644 --- a/src/chasers/chaser_template.cpp +++ b/src/chasers/chaser_template.cpp @@ -43,14 +43,14 @@ chaser_template::chaser_template(full_node& node) NOEXCEPT // TODO: initialize template state. code chaser_template::start() NOEXCEPT { - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } // event handlers // ---------------------------------------------------------------------------- -bool chaser_template::handle_event(const code&, chase event_, +bool chaser_template::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { if (closed()) diff --git a/src/chasers/chaser_transaction.cpp b/src/chasers/chaser_transaction.cpp index de710efa..87a31b67 100644 --- a/src/chasers/chaser_transaction.cpp +++ b/src/chasers/chaser_transaction.cpp @@ -43,14 +43,14 @@ chaser_transaction::chaser_transaction(full_node& node) NOEXCEPT // TODO: initialize tx graph from store, log and stop on error. code chaser_transaction::start() NOEXCEPT { - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } // event handlers // ---------------------------------------------------------------------------- -bool chaser_transaction::handle_event(const code&, chase event_, +bool chaser_transaction::handle_chase(const code&, chase event_, event_value) NOEXCEPT { if (closed()) diff --git a/src/chasers/chaser_validate.cpp b/src/chasers/chaser_validate.cpp index e139f975..8752f7e3 100644 --- a/src/chasers/chaser_validate.cpp +++ b/src/chasers/chaser_validate.cpp @@ -56,11 +56,11 @@ code chaser_validate::start() NOEXCEPT const auto& query = archive(); set_position(query.get_fork()); - SUBSCRIBE_EVENTS(handle_event, _1, _2, _3); + SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); return error::success; } -bool chaser_validate::handle_event(const code&, chase event_, +bool chaser_validate::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { if (closed()) @@ -244,7 +244,7 @@ void chaser_validate::validate_block(const header_link& link, // Prevent stall by posting internal event, avoiding external handlers. if (is_one(backlog_.fetch_sub(one, std::memory_order_relaxed))) - handle_event(error::success, chase::bump, height_t{}); + handle_chase(error::success, chase::bump, height_t{}); } code chaser_validate::populate(bool bypass, const chain::block& block, diff --git a/src/protocols/protocol_block_in_31800.cpp b/src/protocols/protocol_block_in_31800.cpp index 9957ee37..56fb8caa 100644 --- a/src/protocols/protocol_block_in_31800.cpp +++ b/src/protocols/protocol_block_in_31800.cpp @@ -50,7 +50,7 @@ void protocol_block_in_31800::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_event, _1, _2, _3)); + subscribe_events(BIND(handle_chase, _1, _2, _3)); SUBSCRIBE_CHANNEL(block, handle_receive_block, _1, _2); protocol_performer::start(); } @@ -96,7 +96,7 @@ bool protocol_block_in_31800::is_idle() const NOEXCEPT return map_->empty(); } -bool protocol_block_in_31800::handle_event(const code&, chase event_, +bool protocol_block_in_31800::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { // Do not pass ec to stopped as it is not a call status. diff --git a/src/protocols/protocol_block_out_106.cpp b/src/protocols/protocol_block_out_106.cpp index 259ba012..15417867 100644 --- a/src/protocols/protocol_block_out_106.cpp +++ b/src/protocols/protocol_block_out_106.cpp @@ -46,7 +46,7 @@ void protocol_block_out_106::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_event, _1, _2, _3)); + subscribe_events(BIND(handle_chase, _1, _2, _3)); SUBSCRIBE_CHANNEL(get_data, handle_receive_get_data, _1, _2); SUBSCRIBE_CHANNEL(get_blocks, handle_receive_get_blocks, _1, _2); protocol_peer::start(); @@ -63,7 +63,7 @@ void protocol_block_out_106::stopping(const code& ec) NOEXCEPT // handle events (block) // ---------------------------------------------------------------------------- -bool protocol_block_out_106::handle_event(const code&, chase event_, +bool protocol_block_out_106::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { // Do not pass ec to stopped as it is not a call status. diff --git a/src/protocols/protocol_header_out_70012.cpp b/src/protocols/protocol_header_out_70012.cpp index 09240d06..c3db0062 100644 --- a/src/protocols/protocol_header_out_70012.cpp +++ b/src/protocols/protocol_header_out_70012.cpp @@ -59,7 +59,7 @@ void protocol_header_out_70012::stopping(const code& ec) NOEXCEPT // handle events (block) // ---------------------------------------------------------------------------- -bool protocol_header_out_70012::handle_event(const code&, chase event_, +bool protocol_header_out_70012::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { // Do not pass ec to stopped as it is not a call status. @@ -130,7 +130,7 @@ bool protocol_header_out_70012::handle_receive_send_headers(const code& ec, return false; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_event, _1, _2, _3)); + subscribe_events(BIND(handle_chase, _1, _2, _3)); return false; } diff --git a/src/protocols/protocol_observer.cpp b/src/protocols/protocol_observer.cpp index 58401745..2272e8d4 100644 --- a/src/protocols/protocol_observer.cpp +++ b/src/protocols/protocol_observer.cpp @@ -43,7 +43,7 @@ void protocol_observer::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_event, _1, _2, _3)); + subscribe_events(BIND(handle_chase, _1, _2, _3)); if (relay_disallowed_) { @@ -65,7 +65,7 @@ void protocol_observer::stopping(const code& ec) NOEXCEPT // handle events (suspend) // ---------------------------------------------------------------------------- -bool protocol_observer::handle_event(const code&, chase event_, +bool protocol_observer::handle_chase(const code&, chase event_, event_value) NOEXCEPT { // Do not pass ec to stopped as it is not a call status. diff --git a/src/protocols/protocol_transaction_out_106.cpp b/src/protocols/protocol_transaction_out_106.cpp index 7efd9619..e56daef8 100644 --- a/src/protocols/protocol_transaction_out_106.cpp +++ b/src/protocols/protocol_transaction_out_106.cpp @@ -44,7 +44,7 @@ void protocol_transaction_out_106::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_event, _1, _2, _3)); + subscribe_events(BIND(handle_chase, _1, _2, _3)); SUBSCRIBE_CHANNEL(get_data, handle_receive_get_data, _1, _2); protocol_peer::start(); } @@ -60,7 +60,7 @@ void protocol_transaction_out_106::stopping(const code& ec) NOEXCEPT // handle events (transaction) // ---------------------------------------------------------------------------- -bool protocol_transaction_out_106::handle_event(const code&, chase event_, +bool protocol_transaction_out_106::handle_chase(const code&, chase event_, event_value value) NOEXCEPT { // Do not pass ec to stopped as it is not a call status. From 14ac1787b6a434b3b1069f95508b70f08a32fd48 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 16 May 2026 12:37:50 -0400 Subject: [PATCH 2/2] Rename events un/subscribe to chase (name conflict). --- include/bitcoin/node/chasers/chaser.hpp | 6 +++--- include/bitcoin/node/full_node.hpp | 8 ++++---- .../bitcoin/node/impl/chasers/chaser_organize.ipp | 2 +- include/bitcoin/node/protocols/protocol.hpp | 4 ++-- include/bitcoin/node/sessions/session.hpp | 8 ++++---- src/chasers/chaser.cpp | 4 ++-- src/chasers/chaser_check.cpp | 2 +- src/chasers/chaser_confirm.cpp | 2 +- src/chasers/chaser_snapshot.cpp | 2 +- src/chasers/chaser_storage.cpp | 2 +- src/chasers/chaser_template.cpp | 2 +- src/chasers/chaser_transaction.cpp | 2 +- src/chasers/chaser_validate.cpp | 2 +- src/full_node.cpp | 10 +++++----- src/protocols/protocol.cpp | 10 +++++----- src/protocols/protocol_block_in_31800.cpp | 6 +++--- src/protocols/protocol_block_out_106.cpp | 4 ++-- src/protocols/protocol_header_out_70012.cpp | 4 ++-- src/protocols/protocol_observer.cpp | 4 ++-- src/protocols/protocol_transaction_out_106.cpp | 4 ++-- src/sessions/session.cpp | 12 ++++++------ 21 files changed, 50 insertions(+), 50 deletions(-) diff --git a/include/bitcoin/node/chasers/chaser.hpp b/include/bitcoin/node/chasers/chaser.hpp index f8df76bf..bea55dc7 100644 --- a/include/bitcoin/node/chasers/chaser.hpp +++ b/include/bitcoin/node/chasers/chaser.hpp @@ -98,7 +98,7 @@ class BCN_API chaser /// ----------------------------------------------------------------------- /// Call from chaser start methods (requires node strand). - virtual object_key subscribe_events(event_notifier&& handler) NOEXCEPT; + virtual object_key subscribe_chase(event_notifier&& handler) NOEXCEPT; /// Set event (does not require node strand). virtual void notify(const code& ec, chase event_, @@ -164,8 +164,8 @@ class BCN_API chaser size_t position_{}; }; -#define SUBSCRIBE_EVENTS(method, ...) \ - subscribe_events(BIND(method, __VA_ARGS__)) +#define SUBSCRIBE_CHASE(method, ...) \ + subscribe_chase(BIND(method, __VA_ARGS__)) } // namespace node } // namespace libbitcoin diff --git a/include/bitcoin/node/full_node.hpp b/include/bitcoin/node/full_node.hpp index 17b17ad6..9ad408aa 100644 --- a/include/bitcoin/node/full_node.hpp +++ b/include/bitcoin/node/full_node.hpp @@ -93,14 +93,14 @@ class BCN_API full_node event_value value) NOEXCEPT; /// Call from chaser start() methods (requires strand). - virtual object_key subscribe_events(event_notifier&& handler) NOEXCEPT; + virtual object_key subscribe_chase(event_notifier&& handler) NOEXCEPT; /// Call from protocol start() methods. - virtual void subscribe_events(event_notifier&& handler, + virtual void subscribe_chase(event_notifier&& handler, event_completer&& complete) NOEXCEPT; /// Unsubscribe from chaser events. - virtual void unsubscribe_events(object_key key) NOEXCEPT; + virtual void unsubscribe_chase(object_key key) NOEXCEPT; /// Suspensions. /// ----------------------------------------------------------------------- @@ -174,7 +174,7 @@ class BCN_API full_node void do_close() NOEXCEPT override; private: - void do_subscribe_events(const event_notifier& handler, + void do_subscribe_chase(const event_notifier& handler, const event_completer& complete) NOEXCEPT; void do_notify(const code& ec, chase event_, event_value value) NOEXCEPT; void do_notify_one(object_key key, const code& ec, chase event_, diff --git a/include/bitcoin/node/impl/chasers/chaser_organize.ipp b/include/bitcoin/node/impl/chasers/chaser_organize.ipp index b34993de..7b46da01 100644 --- a/include/bitcoin/node/impl/chasers/chaser_organize.ipp +++ b/include/bitcoin/node/impl/chasers/chaser_organize.ipp @@ -61,7 +61,7 @@ code CLASS::start() NOEXCEPT LOGN("Candidate top [" << system::encode_hash(state_->hash()) << ":" << state_->height() << "]."); - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/include/bitcoin/node/protocols/protocol.hpp b/include/bitcoin/node/protocols/protocol.hpp index a07d6431..bbe6a38b 100644 --- a/include/bitcoin/node/protocols/protocol.hpp +++ b/include/bitcoin/node/protocols/protocol.hpp @@ -71,14 +71,14 @@ class BCN_API protocol /// ----------------------------------------------------------------------- /// Subscribe to chaser events (max one active per protocol). - virtual void subscribe_events(event_notifier&& handler) NOEXCEPT; + virtual void subscribe_chase(event_notifier&& handler) NOEXCEPT; /// Override to handle subscription completion (stranded). virtual void subscribed(const code& ec, object_key key) NOEXCEPT; /// Unsubscribe from chaser events. /// Subscribing protocol must invoke from overridden stopping(). - virtual void unsubscribe_events() NOEXCEPT; + virtual void unsubscribe_chase() NOEXCEPT; /// Get the subscription key (for notify_one). virtual object_key events_key() const NOEXCEPT; diff --git a/include/bitcoin/node/sessions/session.hpp b/include/bitcoin/node/sessions/session.hpp index c24723d9..2a2388f6 100644 --- a/include/bitcoin/node/sessions/session.hpp +++ b/include/bitcoin/node/sessions/session.hpp @@ -63,14 +63,14 @@ class BCN_API session event_value value) const NOEXCEPT; /// Subscribe to chaser events (requires node strand). - virtual object_key subscribe_events(event_notifier&& handler) NOEXCEPT; + virtual object_key subscribe_chase(event_notifier&& handler) NOEXCEPT; /// Subscribe to chaser events. - virtual void subscribe_events(event_notifier&& handler, + virtual void subscribe_chase(event_notifier&& handler, event_completer&& complete) NOEXCEPT; /// Unsubscribe from chaser events. - virtual void unsubscribe_events(object_key key) NOEXCEPT; + virtual void unsubscribe_chase(object_key key) NOEXCEPT; /// Methods. /// ----------------------------------------------------------------------- @@ -115,7 +115,7 @@ class BCN_API session session(full_node& node) NOEXCEPT; private: - void do_subscribe_events(const event_notifier& handler, + void do_subscribe_chase(const event_notifier& handler, const event_completer& complete) NOEXCEPT; private: diff --git a/src/chasers/chaser.cpp b/src/chasers/chaser.cpp index 7f2e82a1..5fc64495 100644 --- a/src/chasers/chaser.cpp +++ b/src/chasers/chaser.cpp @@ -89,9 +89,9 @@ code chaser::reload(const store::event_handler& handler) NOEXCEPT // Events. // ---------------------------------------------------------------------------- -object_key chaser::subscribe_events(event_notifier&& handler) NOEXCEPT +object_key chaser::subscribe_chase(event_notifier&& handler) NOEXCEPT { - return node_.subscribe_events(std::move(handler)); + return node_.subscribe_chase(std::move(handler)); } void chaser::notify(const code& ec, chase event_, diff --git a/src/chasers/chaser_check.cpp b/src/chasers/chaser_check.cpp index 291e55dc..68e72f98 100644 --- a/src/chasers/chaser_check.cpp +++ b/src/chasers/chaser_check.cpp @@ -96,7 +96,7 @@ code chaser_check::start() NOEXCEPT const auto added = set_unassociated(); LOGN("Fork point (" << requested_ << ") unassociated (" << added << ")."); - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/src/chasers/chaser_confirm.cpp b/src/chasers/chaser_confirm.cpp index 5fc34a64..d1fb50b7 100644 --- a/src/chasers/chaser_confirm.cpp +++ b/src/chasers/chaser_confirm.cpp @@ -52,7 +52,7 @@ code chaser_confirm::start() NOEXCEPT if (!defer_) { - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); } return error::success; diff --git a/src/chasers/chaser_snapshot.cpp b/src/chasers/chaser_snapshot.cpp index 08d605e9..9eefc134 100644 --- a/src/chasers/chaser_snapshot.cpp +++ b/src/chasers/chaser_snapshot.cpp @@ -65,7 +65,7 @@ code chaser_snapshot::start() NOEXCEPT ////if (enabled_confirm_) //// confirm_ = std::max(archive().get_top_confirmed(), checkpoint()); - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/src/chasers/chaser_storage.cpp b/src/chasers/chaser_storage.cpp index 20a00ac8..7abbd33d 100644 --- a/src/chasers/chaser_storage.cpp +++ b/src/chasers/chaser_storage.cpp @@ -50,7 +50,7 @@ code chaser_storage::start() NOEXCEPT // Construct is too early to create the unstarted timer. disk_timer_ = std::make_shared(log, strand(), seconds{1}); - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/src/chasers/chaser_template.cpp b/src/chasers/chaser_template.cpp index 327836a4..b6aa2077 100644 --- a/src/chasers/chaser_template.cpp +++ b/src/chasers/chaser_template.cpp @@ -43,7 +43,7 @@ chaser_template::chaser_template(full_node& node) NOEXCEPT // TODO: initialize template state. code chaser_template::start() NOEXCEPT { - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/src/chasers/chaser_transaction.cpp b/src/chasers/chaser_transaction.cpp index 87a31b67..ee6a5fcb 100644 --- a/src/chasers/chaser_transaction.cpp +++ b/src/chasers/chaser_transaction.cpp @@ -43,7 +43,7 @@ chaser_transaction::chaser_transaction(full_node& node) NOEXCEPT // TODO: initialize tx graph from store, log and stop on error. code chaser_transaction::start() NOEXCEPT { - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/src/chasers/chaser_validate.cpp b/src/chasers/chaser_validate.cpp index 8752f7e3..014dbe4c 100644 --- a/src/chasers/chaser_validate.cpp +++ b/src/chasers/chaser_validate.cpp @@ -56,7 +56,7 @@ code chaser_validate::start() NOEXCEPT const auto& query = archive(); set_position(query.get_fork()); - SUBSCRIBE_EVENTS(handle_chase, _1, _2, _3); + SUBSCRIBE_CHASE(handle_chase, _1, _2, _3); return error::success; } diff --git a/src/full_node.cpp b/src/full_node.cpp index 38a8dc3a..bd9d36a1 100644 --- a/src/full_node.cpp +++ b/src/full_node.cpp @@ -216,7 +216,7 @@ void full_node::do_notify_one(object_key key, const code& ec, chase event_, event_subscriber_.notify_one(key, ec, event_, value); } -object_key full_node::subscribe_events(event_notifier&& handler) NOEXCEPT +object_key full_node::subscribe_chase(event_notifier&& handler) NOEXCEPT { BC_ASSERT(stranded()); const auto key = create_key(); @@ -224,16 +224,16 @@ object_key full_node::subscribe_events(event_notifier&& handler) NOEXCEPT return key; } -void full_node::subscribe_events(event_notifier&& handler, +void full_node::subscribe_chase(event_notifier&& handler, event_completer&& complete) NOEXCEPT { boost::asio::post(strand(), - std::bind(&full_node::do_subscribe_events, + std::bind(&full_node::do_subscribe_chase, this, std::move(handler), std::move(complete))); } // private -void full_node::do_subscribe_events(const event_notifier& handler, +void full_node::do_subscribe_chase(const event_notifier& handler, const event_completer& complete) NOEXCEPT { BC_ASSERT(stranded()); @@ -241,7 +241,7 @@ void full_node::do_subscribe_events(const event_notifier& handler, complete(event_subscriber_.subscribe(move_copy(handler), key), key); } -void full_node::unsubscribe_events(object_key key) NOEXCEPT +void full_node::unsubscribe_chase(object_key key) NOEXCEPT { notify_one(key, network::error::service_stopped, chase::stop, {}); } diff --git a/src/protocols/protocol.cpp b/src/protocols/protocol.cpp index 93e59481..0db05381 100644 --- a/src/protocols/protocol.cpp +++ b/src/protocols/protocol.cpp @@ -69,7 +69,7 @@ bool protocol::is_current(bool confirmed) const NOEXCEPT // Events subscription. // ---------------------------------------------------------------------------- -void protocol::subscribe_events(event_notifier&& handler) NOEXCEPT +void protocol::subscribe_chase(event_notifier&& handler) NOEXCEPT { // This is a shared instance multiply-derived from network::protocol. const auto self = dynamic_cast(*this) @@ -78,7 +78,7 @@ void protocol::subscribe_events(event_notifier&& handler) NOEXCEPT event_completer completer = std::bind(&protocol::handle_subscribed, self, _1, _2); - session_->subscribe_events(std::move(handler), + session_->subscribe_chase(std::move(handler), std::bind(&protocol::handle_subscribe, self, _1, _2, std::move(completer))); } @@ -117,13 +117,13 @@ void protocol::subscribed(const code& ec, object_key) NOEXCEPT // Unsubscriber race is ok. if (channel_->stopped() || ec) - unsubscribe_events(); + unsubscribe_chase(); } // As this has no completion handler resubscription is not allowed. -void protocol::unsubscribe_events() NOEXCEPT +void protocol::unsubscribe_chase() NOEXCEPT { - session_->unsubscribe_events(key_); + session_->unsubscribe_chase(key_); key_ = {}; } diff --git a/src/protocols/protocol_block_in_31800.cpp b/src/protocols/protocol_block_in_31800.cpp index 56fb8caa..23525148 100644 --- a/src/protocols/protocol_block_in_31800.cpp +++ b/src/protocols/protocol_block_in_31800.cpp @@ -50,7 +50,7 @@ void protocol_block_in_31800::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_chase, _1, _2, _3)); + subscribe_chase(BIND(handle_chase, _1, _2, _3)); SUBSCRIBE_CHANNEL(block, handle_receive_block, _1, _2); protocol_performer::start(); } @@ -63,7 +63,7 @@ void protocol_block_in_31800::subscribed(const code& ec, object_key) NOEXCEPT // stopped() is true before stopping() is called (by base). if (stopped(ec)) { - unsubscribe_events(); + unsubscribe_chase(); return; } @@ -83,7 +83,7 @@ void protocol_block_in_31800::stopping(const code& ec) NOEXCEPT restore(map_); map_ = chaser_check::empty_map(); stop_performance(); - unsubscribe_events(); + unsubscribe_chase(); protocol_performer::stopping(ec); } diff --git a/src/protocols/protocol_block_out_106.cpp b/src/protocols/protocol_block_out_106.cpp index 15417867..13c90ebe 100644 --- a/src/protocols/protocol_block_out_106.cpp +++ b/src/protocols/protocol_block_out_106.cpp @@ -46,7 +46,7 @@ void protocol_block_out_106::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_chase, _1, _2, _3)); + subscribe_chase(BIND(handle_chase, _1, _2, _3)); SUBSCRIBE_CHANNEL(get_data, handle_receive_get_data, _1, _2); SUBSCRIBE_CHANNEL(get_blocks, handle_receive_get_blocks, _1, _2); protocol_peer::start(); @@ -56,7 +56,7 @@ void protocol_block_out_106::stopping(const code& ec) NOEXCEPT { // Unsubscriber race is ok. BC_ASSERT(stranded()); - unsubscribe_events(); + unsubscribe_chase(); protocol_peer::stopping(ec); } diff --git a/src/protocols/protocol_header_out_70012.cpp b/src/protocols/protocol_header_out_70012.cpp index c3db0062..454dd0ce 100644 --- a/src/protocols/protocol_header_out_70012.cpp +++ b/src/protocols/protocol_header_out_70012.cpp @@ -52,7 +52,7 @@ void protocol_header_out_70012::stopping(const code& ec) NOEXCEPT { // Unsubscriber race is ok. BC_ASSERT(stranded()); - unsubscribe_events(); + unsubscribe_chase(); protocol_header_out_31800::stopping(ec); } @@ -130,7 +130,7 @@ bool protocol_header_out_70012::handle_receive_send_headers(const code& ec, return false; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_chase, _1, _2, _3)); + subscribe_chase(BIND(handle_chase, _1, _2, _3)); return false; } diff --git a/src/protocols/protocol_observer.cpp b/src/protocols/protocol_observer.cpp index 2272e8d4..59c1ece2 100644 --- a/src/protocols/protocol_observer.cpp +++ b/src/protocols/protocol_observer.cpp @@ -43,7 +43,7 @@ void protocol_observer::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_chase, _1, _2, _3)); + subscribe_chase(BIND(handle_chase, _1, _2, _3)); if (relay_disallowed_) { @@ -58,7 +58,7 @@ void protocol_observer::stopping(const code& ec) NOEXCEPT { // Unsubscriber race is ok. BC_ASSERT(stranded()); - unsubscribe_events(); + unsubscribe_chase(); protocol_peer::stopping(ec); } diff --git a/src/protocols/protocol_transaction_out_106.cpp b/src/protocols/protocol_transaction_out_106.cpp index e56daef8..6ca35a72 100644 --- a/src/protocols/protocol_transaction_out_106.cpp +++ b/src/protocols/protocol_transaction_out_106.cpp @@ -44,7 +44,7 @@ void protocol_transaction_out_106::start() NOEXCEPT return; // Events subscription is asynchronous, events may be missed. - subscribe_events(BIND(handle_chase, _1, _2, _3)); + subscribe_chase(BIND(handle_chase, _1, _2, _3)); SUBSCRIBE_CHANNEL(get_data, handle_receive_get_data, _1, _2); protocol_peer::start(); } @@ -53,7 +53,7 @@ void protocol_transaction_out_106::stopping(const code& ec) NOEXCEPT { // Unsubscriber race is ok. BC_ASSERT(stranded()); - unsubscribe_events(); + unsubscribe_chase(); protocol_peer::stopping(ec); } diff --git a/src/sessions/session.cpp b/src/sessions/session.cpp index 63752d8f..101902ed 100644 --- a/src/sessions/session.cpp +++ b/src/sessions/session.cpp @@ -78,20 +78,20 @@ void session::notify_one(object_key key, const code& ec, chase event_, node_.notify_one(key, ec, event_, value); } -object_key session::subscribe_events(event_notifier&& handler) NOEXCEPT +object_key session::subscribe_chase(event_notifier&& handler) NOEXCEPT { - return node_.subscribe_events(std::move(handler)); + return node_.subscribe_chase(std::move(handler)); } -void session::subscribe_events(event_notifier&& handler, +void session::subscribe_chase(event_notifier&& handler, event_completer&& complete) NOEXCEPT { - node_.subscribe_events(std::move(handler), std::move(complete)); + node_.subscribe_chase(std::move(handler), std::move(complete)); } -void session::unsubscribe_events(object_key key) NOEXCEPT +void session::unsubscribe_chase(object_key key) NOEXCEPT { - node_.unsubscribe_events(key); + node_.unsubscribe_chase(key); } // Methods.