Skip to content

Commit

Permalink
Move header chaser tree_ to protected, for test.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Feb 16, 2024
1 parent 525416e commit ca2d033
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions include/bitcoin/node/chasers/chaser_header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace node {
class full_node;

/// Chase down stronger header branches for the candidate chain.
/// Weak branches are retained in a hash table unless already store populated.
/// Weak branches are retained in a hash table if not store populated.
/// Strong branches reorganize the candidate chain and fire the 'header' event.
class BCN_API chaser_header
: public chaser
Expand All @@ -48,8 +48,16 @@ class BCN_API chaser_header
system::chain::context&& context) NOEXCEPT;

protected:
struct proposed_header
{
database::context context;
system::chain::header::cptr header;
};
typedef std::vector<database::header_link> header_links;

// This is protected by strand.
std::unordered_map<system::hash_digest, proposed_header> tree_{};

/// Handlers.
virtual void handle_event(const code& ec, chase event_,
link value) NOEXCEPT;
Expand Down Expand Up @@ -81,18 +89,11 @@ class BCN_API chaser_header
virtual bool push(const system::hash_digest& key) NOEXCEPT;

private:
struct proposed_header
{
database::context context;
system::chain::header::cptr header;
};

void do_handle_event(const code& ec, chase event_, link value) NOEXCEPT;
void do_organize(const system::chain::header::cptr& header,
const system::chain::context& context) NOEXCEPT;

// These are protected by strand.
std::unordered_map<system::hash_digest, proposed_header> tree_{};
// These are thread safe.
const network::wall_clock::duration currency_window_;
const bool use_currency_window_;
};
Expand Down

0 comments on commit ca2d033

Please sign in to comment.