Skip to content

Commit

Permalink
Remove sequential confirmation code.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jun 27, 2024
1 parent d6149b9 commit 2be8044
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 116 deletions.
3 changes: 0 additions & 3 deletions include/bitcoin/node/chasers/chaser_confirm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ class BCN_API chaser_confirm
event_value value) NOEXCEPT;

virtual void do_validated(height_t height) NOEXCEPT;
#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 Down
113 changes: 0 additions & 113 deletions src/chasers/chaser_confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,117 +184,6 @@ void chaser_confirm::do_validated(height_t height) NOEXCEPT
do_organize(add1(fork_point_));
}

#if defined(SEQUENTIAL)

void chaser_confirm::do_organize(size_t height) NOEXCEPT
{
auto& query = archive();

// Push candidate headers to confirmed chain.
for (const auto& link: views_reverse(fork_))
{
if (closed())
return;

// database::error::unassociated
// database::error::block_unconfirmable
// database::error::block_confirmable
// database::error::block_valid
// database::error::unknown_state
// database::error::unvalidated
auto ec = query.get_block_state(link);
if (ec == database::error::block_unconfirmable)
{
notify(ec, chase::unconfirmable, link);
fire(events::block_unconfirmable, height);

if (!roll_back(popped_, link, fork_point_, height))
fault(error::node_roll_back);

return;
}

const auto checked = is_under_checkpoint(height) ||
query.is_milestone(link);

// Required for block_confirmable and all confirmed blocks.
if (!checked && !query.set_strong(link))
{
fault(error::set_strong);
return;
}

if (ec == database::error::block_confirmable || checked)
{
// TODO: compute fees from validation records.
if ((ec != database::error::block_confirmable) &&
!query.set_block_confirmable(link, uint64_t{}))
{
fault(error::set_block_confirmable);
return;
}

notify(ec, chase::confirmable, height);
////fire(events::confirm_bypassed, height);

if (!set_organized(link, height))
{
fault(error::set_organized);
return;
}
}
else
{
ec = query.block_confirmable(link);
if (ec == database::error::integrity)
{
fault(error::get_block_confirmable);
return;
}

if (ec)
{
if (!query.set_block_unconfirmable(link))
{
fault(error::set_block_unconfirmable);
return;
}

LOGR("Unconfirmable block [" << height << "] " << ec.message());
notify(ec, chase::unconfirmable, link);
fire(events::block_unconfirmable, height);

if (!roll_back(popped_, link, fork_point_, height))
fault(error::node_roll_back);

return;
}

// TODO: compute fees from validation records.
if (!query.set_block_confirmable(link, uint64_t{}))
{
fault(error::set_block_confirmable);
return;
}

notify(error::success, chase::confirmable, height);
fire(events::block_confirmed, height);

if (!set_organized(link, height))
{
fault(error::set_organized);
return;
}
}

LOGV("Block confirmed and organized: " << height);
++height;
}
}

#else

// CONCURRENT
void chaser_confirm::do_organize(size_t height) NOEXCEPT
{
if (fork_.empty())
Expand Down Expand Up @@ -512,8 +401,6 @@ void chaser_confirm::next_block(size_t height) NOEXCEPT
}
}

#endif // SEQUENTIAL

// Private
// ----------------------------------------------------------------------------

Expand Down

0 comments on commit 2be8044

Please sign in to comment.