Skip to content

Commit

Permalink
Merge pull request #546 from evoskuil/master
Browse files Browse the repository at this point in the history
Style, remove chaser reporter (log), remove bad assertion.
  • Loading branch information
evoskuil authored Feb 26, 2024
2 parents 0afb56a + c1b3b3e commit 14d21f4
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 28 deletions.
3 changes: 2 additions & 1 deletion include/bitcoin/node/chasers/chaser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class full_node;
/// Notifications are bounced from sink (e.g. chaser) to its strand, and
/// notify bounces from source (e.g. chaser) to network strand.
/// Unlike protocols chasers can stop the node.
/// Logging is currently disabled so that logging is kept to the protocols.
class BCN_API chaser
: public network::reporter
//// : public network::reporter
{
public:
enum class chase
Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
chaser::chaser(full_node& node) NOEXCEPT
: node_(node),
strand_(node.service().get_executor()),
subscriber_(node.event_subscriber()),
reporter(node.log)
subscriber_(node.event_subscriber())
////reporter(node.log)
{
}

Expand Down
3 changes: 1 addition & 2 deletions src/chasers/chaser_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ chaser_block::~chaser_block() NOEXCEPT

code chaser_block::start() NOEXCEPT
{
BC_ASSERT_MSG(node_stranded(), "chaser_block");

state_ = archive().get_candidate_chain_state(config().bitcoin);
BC_ASSERT_MSG(state_, "Store not initialized.");

BC_ASSERT_MSG(node_stranded(), "chaser_block");
return subscribe(
std::bind(&chaser_block::handle_event,
this, _1, _2, _3));
Expand Down
3 changes: 1 addition & 2 deletions src/chasers/chaser_candidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ void chaser_candidate::do_handle_event(const code& ec, chase event_,
}

// TODO: handle transaction graph change (may issue 'candidate').
void chaser_candidate::handle_transaction(transaction_t tx) NOEXCEPT
void chaser_candidate::handle_transaction(transaction_t) NOEXCEPT
{
BC_ASSERT_MSG(stranded(), "chaser_candidate");
LOGN("Handle transaction pool updated (" << tx << ").");
}

BC_POP_WARNING()
Expand Down
19 changes: 3 additions & 16 deletions src/chasers/chaser_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ using namespace std::placeholders;

BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)

/// We need to be able to perform block.check(ctx) while we still have the
/// deserialized block, because of the witness commitment check (hash).
/// Requires timestamp (header) height, mtp, flags. These can be cached on the
/// block hash registry maintained by this chaser or queried from the stored
/// header. Caching requries rolling forward through all states as the registry
/// is initialized. Store query is simpler and may be as fast.

chaser_check::chaser_check(full_node& node) NOEXCEPT
: chaser(node)
{
Expand All @@ -53,11 +46,10 @@ chaser_check::~chaser_check() NOEXCEPT

code chaser_check::start() NOEXCEPT
{
BC_ASSERT_MSG(node_stranded(), "chaser_check");

// Initialize from genesis block.
handle_header(zero);

BC_ASSERT_MSG(node_stranded(), "chaser_check");
return subscribe(
std::bind(&chaser_check::handle_event,
this, _1, _2, _3));
Expand Down Expand Up @@ -116,17 +108,12 @@ void chaser_check::do_put_hashes(const chaser_check::map&,

void chaser_check::handle_header(height_t branch_point) NOEXCEPT
{
BC_ASSERT_MSG(stranded(), "chaser_check");

// Map and peer maps may have newly stale blocks.
// All stale branches can just be allowed to complete.
// The connect chaser will verify proper advancement.

// get_all_unassociated_above(branch_point) and add to map.
const auto& query = archive();
const auto top = query.get_top_candidate();
const auto last = query.get_last_associated_from(branch_point);
map_.merge(query.get_all_unassociated_above(last));
map_.merge(query.get_all_unassociated_above(
query.get_last_associated_from(branch_point)));
}

BC_POP_WARNING()
Expand Down
3 changes: 1 addition & 2 deletions src/chasers/chaser_confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ void chaser_confirm::do_handle_event(const code& ec, chase event_,
}

// TODO: handle new strong connected branch (may issue 'confirmed').
void chaser_confirm::handle_connected(header_t block) NOEXCEPT
void chaser_confirm::handle_connected(header_t) NOEXCEPT
{
BC_ASSERT_MSG(stranded(), "chaser_confirm");
LOGN("Handle connected block (" << block << ").");
}

BC_POP_WARNING()
Expand Down
1 change: 0 additions & 1 deletion src/chasers/chaser_connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void chaser_connect::do_handle_event(const code& ec, chase event_,
void chaser_connect::handle_checked(header_t) NOEXCEPT
{
BC_ASSERT_MSG(stranded(), "chaser_connect");
////LOGN("Handle candidate organization above height (" << block << ").");
}

BC_POP_WARNING()
Expand Down
3 changes: 1 addition & 2 deletions src/chasers/chaser_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ bool chaser_header::use_currency_window() const NOEXCEPT
// protected
code chaser_header::start() NOEXCEPT
{
BC_ASSERT_MSG(node_stranded(), "chaser_header");

state_ = archive().get_candidate_chain_state(config().bitcoin);
BC_ASSERT_MSG(state_, "Store not initialized.");

BC_ASSERT_MSG(node_stranded(), "chaser_header");
return subscribe(
std::bind(&chaser_header::handle_event,
this, _1, _2, _3));
Expand Down

0 comments on commit 14d21f4

Please sign in to comment.