Skip to content

Commit

Permalink
Generalized confirm chaser for parallel or sequential.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jun 26, 2024
1 parent 0e62148 commit fad60af
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 138 deletions.
14 changes: 9 additions & 5 deletions include/bitcoin/node/chasers/chaser_confirm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <bitcoin/node/chasers/chaser.hpp>
#include <bitcoin/node/define.hpp>

#define SEQUENTIAL

namespace libbitcoin {
namespace node {

Expand All @@ -47,7 +49,9 @@ class BCN_API chaser_confirm
event_value value) NOEXCEPT;

virtual void do_validated(height_t height) NOEXCEPT;
#if defined(UNDEFINED)
#if defined(SEQUENTIAL)
virtual void do_organize(size_t height) NOEXCEPT;
#else
virtual void do_organize(size_t height) NOEXCEPT;
virtual bool enqueue_block(const database::header_link& link) NOEXCEPT;
virtual void confirm_tx(const database::context& ctx,
Expand All @@ -58,7 +62,8 @@ class BCN_API chaser_confirm
const database::header_link& link, size_t height)NOEXCEPT;
virtual void confirm_block(const code& ec,
const database::header_link& link, size_t height) NOEXCEPT;
#endif // UNDEFINED
virtual void next_block(size_t height) NOEXCEPT;
#endif // SEQUENTIAL

private:
bool set_organized(const database::header_link& link,
Expand All @@ -67,9 +72,8 @@ class BCN_API chaser_confirm
height_t height) NOEXCEPT;
bool set_reorganized(const database::header_link& link,
height_t height) NOEXCEPT;
bool roll_back(const header_links& popped,
const database::header_link& link, size_t fork_point,
size_t top) NOEXCEPT;
bool roll_back(header_links& popped, const database::header_link& link,
size_t fork_point, size_t top) NOEXCEPT;

bool get_fork_work(uint256_t& fork_work, header_links& fork,
height_t fork_top) const NOEXCEPT;
Expand Down
Loading

0 comments on commit fad60af

Please sign in to comment.