Skip to content

Commit

Permalink
Merge pull request #646 from evoskuil/master
Browse files Browse the repository at this point in the history
Implement confirmation concurrency (disabled).
  • Loading branch information
evoskuil committed Jun 18, 2024
2 parents c658876 + 69fcdcf commit 7ddb97d
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 173 deletions.
17 changes: 17 additions & 0 deletions include/bitcoin/node/chasers/chaser_confirm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,22 @@ class BCN_API chaser_confirm

protected:
using header_links = std::vector<database::header_link>;
typedef network::race_unity<const code&, const database::tx_link&> race;

virtual bool handle_event(const code& ec, chase event_,
event_value value) NOEXCEPT;

virtual void do_validated(height_t height) NOEXCEPT;
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& context,
const database::tx_link& link, const race::ptr& racer) NOEXCEPT;
virtual void handle_tx(const code& ec, const database::tx_link& tx,
const race::ptr& racer) NOEXCEPT;
virtual void handle_txs(const code& ec, const database::tx_link& tx,
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;

private:
bool set_organized(const database::header_link& link,
Expand All @@ -62,6 +73,12 @@ class BCN_API chaser_confirm
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_;
header_links popped_{};
header_links fork_{};
size_t fork_point_{};
};

} // namespace node
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 @@ -577,11 +577,11 @@ code CLASS::push_block(const Block& block,
// set milestone and sets strong if milestone or checkpoint.
const auto checkpoint = is_under_checkpoint(context.height);
const auto milestone = is_under_milestone(context.height);
const auto strong = is_block() && (checkpoint || milestone);
const auto is_strong = is_block() && (checkpoint || milestone);

auto& query = archive();
database::header_link link{};
const auto ec = query.set_code(link, block, context, milestone, strong);
const auto ec = query.set_code(link, block, context, milestone, is_strong);
if (ec)
return ec;

Expand Down
Loading

0 comments on commit 7ddb97d

Please sign in to comment.