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
3 changes: 3 additions & 0 deletions include/bitcoin/node/chasers/chaser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ class BCN_API chaser
/// The height is at or below the top checkpoint.
bool is_under_checkpoint(size_t height) const NOEXCEPT;

/// The height of the top checkpoint.
size_t checkpoint() const NOEXCEPT;

/// Position (requires strand).
/// -----------------------------------------------------------------------

Expand Down
40 changes: 10 additions & 30 deletions include/bitcoin/node/chasers/chaser_confirm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <bitcoin/node/chasers/chaser.hpp>
#include <bitcoin/node/define.hpp>

////#define SEQUENTIAL

namespace libbitcoin {
namespace node {

Expand All @@ -40,8 +38,6 @@ class BCN_API chaser_confirm
chaser_confirm(full_node& node) NOEXCEPT;

code start() NOEXCEPT override;
void stopping(const code& ec) NOEXCEPT override;
void stop() NOEXCEPT override;

protected:
using header_links = std_vector<database::header_link>;
Expand All @@ -50,45 +46,29 @@ class BCN_API chaser_confirm
virtual bool handle_event(const code& ec, chase event_,
event_value value) NOEXCEPT;

////virtual void do_checking(height_t height) NOEXCEPT;
virtual void do_regressed(height_t branch_point) NOEXCEPT;
virtual void do_validated(height_t height) NOEXCEPT;
virtual void do_bump(height_t branch_point) NOEXCEPT;

////virtual void do_reorganize(header_links& fork, size_t fork_point) NOEXCEPT;
////virtual void do_organize(header_links& fork, const header_links& popped,
//// size_t fork_point) NOEXCEPT;
virtual void do_bump(height_t height) NOEXCEPT;

// Override base class strand because it sits on the network thread pool.
network::asio::strand& strand() NOEXCEPT override;
bool stranded() const NOEXCEPT override;
virtual void reorganize(header_links& fork, size_t fork_point) NOEXCEPT;
virtual void organize(header_links& fork, const header_links& popped,
size_t fork_point) NOEXCEPT;

private:
struct neutrino_header
{
system::hash_digest head{};
database::header_link link{};
};

bool set_organized(const database::header_link& link,
height_t height) NOEXCEPT;
bool reset_organized(const database::header_link& link,
height_t height) NOEXCEPT;
// setters
bool set_regressed(height_t candidate_height) NOEXCEPT;
bool set_reorganized(const database::header_link& link,
height_t height) NOEXCEPT;
height_t confirmed_height) NOEXCEPT;
bool set_organized(const database::header_link& link,
height_t confirmed_height, bool bypassed) NOEXCEPT;
bool roll_back(const header_links& popped, size_t fork_point,
size_t top) NOEXCEPT;

// getters
bool get_fork_work(uint256_t& fork_work, header_links& fork,
height_t fork_top) const NOEXCEPT;
bool get_is_strong(bool& strong, const uint256_t& fork_work,
size_t fork_point) const NOEXCEPT;

// These are protected by strand.
network::threadpool threadpool_;

// These are thread safe.
network::asio::strand independent_strand_;
};

} // namespace node
Expand Down
8 changes: 3 additions & 5 deletions include/bitcoin/node/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ enum error_t : uint8_t
confirm10,
confirm11,
confirm12,
confirm13,
confirm14,
confirm15,
confirm16,
confirm17
confirm13
////confirm14,
////confirm15
};

// No current need for error_code equivalence mapping.
Expand Down
15 changes: 10 additions & 5 deletions src/chasers/chaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ bool chaser::is_current(uint32_t timestamp) const NOEXCEPT
return node_.is_current(timestamp);
}

bool chaser::is_under_checkpoint(size_t height) const NOEXCEPT
{
return height <= top_checkpoint_height_;
}

// get_timestamp error results in false (ok).
bool chaser::is_current(const database::header_link& link) const NOEXCEPT
{
Expand All @@ -151,6 +146,16 @@ bool chaser::is_current(const database::header_link& link) const NOEXCEPT
node_.is_current(timestamp);
}

bool chaser::is_under_checkpoint(size_t height) const NOEXCEPT
{
return height <= checkpoint();
}

size_t chaser::checkpoint() const NOEXCEPT
{
return top_checkpoint_height_;
}

// Position.
// ----------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion src/chasers/chaser_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ bool chaser_check::handle_event(const code&, chase event_,
POST(do_headers, std::get<height_t>(value));
break;
}
////case chase::confirmable:
case chase::valid:
{
BC_ASSERT(std::holds_alternative<height_t>(value));
Expand Down
Loading
Loading