Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/bitcoin/node/chasers/chaser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_check.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_confirm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_organize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_validate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BCN_API chaser_validate

typedef network::race_unity<const code&, const database::tx_link&> 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;
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/full_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// -----------------------------------------------------------------------
Expand Down Expand Up @@ -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_,
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/impl/chasers/chaser_organize.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CHASE(handle_chase, _1, _2, _3);
return error::success;
}

Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/protocols/protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/protocols/protocol_block_in_31800.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/protocols/protocol_block_out_106.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/protocols/protocol_observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/sessions/session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// -----------------------------------------------------------------------
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CHASE(handle_chase, _1, _2, _3);
return error::success;
}

Expand All @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions src/chasers/chaser_confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ code chaser_confirm::start() NOEXCEPT

if (!defer_)
{
SUBSCRIBE_EVENTS(handle_event, _1, _2, _3);
SUBSCRIBE_CHASE(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())
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CHASE(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())
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ code chaser_storage::start() NOEXCEPT
// Construct is too early to create the unstarted timer.
disk_timer_ = std::make_shared<deadline>(log, strand(), seconds{1});

SUBSCRIBE_EVENTS(handle_event, _1, _2, _3);
SUBSCRIBE_CHASE(handle_chase, _1, _2, _3);
return error::success;
}

Expand All @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CHASE(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())
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CHASE(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())
Expand Down
6 changes: 3 additions & 3 deletions src/chasers/chaser_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CHASE(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())
Expand Down Expand Up @@ -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,
Expand Down
Loading
Loading