Skip to content

Commit

Permalink
Call set_block_unconfirmable on populate() errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jan 13, 2025
1 parent a33a9c7 commit 37f0680
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions include/bitcoin/node/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ enum error_t : uint8_t
validate5,
validate6,
validate7,
validate8,
validate9,
confirm1,
confirm2,
confirm3,
Expand Down
18 changes: 12 additions & 6 deletions src/chasers/chaser_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,33 +221,37 @@ void chaser_validate::validate_block(const header_link& link) NOEXCEPT
else if (!block->populate(ctx))
{
ec = system::error::relative_time_locked;
if (!query.set_block_unconfirmable(link))
ec = error::validate3;
}
else if (!query.populate(*block))
{
ec = system::error::missing_previous_output;
if (!query.set_block_unconfirmable(link))
ec = error::validate4;
}
else if ((ec = block->accept(ctx, subsidy_interval_, initial_subsidy_)))
{
if (!query.set_block_unconfirmable(link))
ec = error::validate3;
ec = error::validate5;
}
else if ((ec = block->connect(ctx)))
{
if (!query.set_block_unconfirmable(link))
ec = error::validate4;
ec = error::validate6;
}
else if (!query.set_block_valid(link, block->fees()))
{
ec = error::validate5;
ec = error::validate7;
}
else if (!query.set_prevouts(link, *block))
{
ec = error::validate6;
ec = error::validate8;
}
else if (!query.set_filter_body(link, *block))
{
// TODO: this should not bypass checkpoint/milestone if enabled.
ec = error::validate7;
ec = error::validate9;
}
else
{
Expand Down Expand Up @@ -275,7 +279,9 @@ void chaser_validate::complete_block(const code& ec, const header_link& link,
ec == error::validate4 ||
ec == error::validate5 ||
ec == error::validate6 ||
ec == error::validate7)
ec == error::validate7 ||
ec == error::validate8 ||
ec == error::validate9)
{
fault(ec);
return;
Expand Down
2 changes: 2 additions & 0 deletions src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
{ validate5, "validate5" },
{ validate6, "validate6" },
{ validate7, "validate7" },
{ validate8, "validate8" },
{ validate9, "validate9" },
{ confirm1, "confirm1" },
{ confirm2, "confirm2" },
{ confirm3, "confirm3" },
Expand Down

0 comments on commit 37f0680

Please sign in to comment.