From 37f068043b067bc2cacb050f89021cc3ae0cbb6e Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 13 Jan 2025 11:45:28 -0500 Subject: [PATCH] Call set_block_unconfirmable on populate() errors. --- include/bitcoin/node/error.hpp | 2 ++ src/chasers/chaser_validate.cpp | 18 ++++++++++++------ src/error.cpp | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/bitcoin/node/error.hpp b/include/bitcoin/node/error.hpp index a24afedc..cce33949 100644 --- a/include/bitcoin/node/error.hpp +++ b/include/bitcoin/node/error.hpp @@ -83,6 +83,8 @@ enum error_t : uint8_t validate5, validate6, validate7, + validate8, + validate9, confirm1, confirm2, confirm3, diff --git a/src/chasers/chaser_validate.cpp b/src/chasers/chaser_validate.cpp index 5fab9114..db7dfc8d 100644 --- a/src/chasers/chaser_validate.cpp +++ b/src/chasers/chaser_validate.cpp @@ -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 { @@ -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; diff --git a/src/error.cpp b/src/error.cpp index cb61db99..7a986704 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -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" },