Skip to content

Commit

Permalink
Rename error::merkle_mismatch to invalid_transaction_commitment.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jun 4, 2024
1 parent d22356a commit 16c1422
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/bitcoin/system/error/block_error_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum block_error_t : uint8_t
internal_duplicate,
block_internal_double_spend,
forward_reference,
merkle_mismatch,
invalid_transaction_commitment,
block_legacy_sigop_limit,
type32_malleated,

Expand Down
4 changes: 2 additions & 2 deletions src/chain/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ code block::check(bool bypass) const NOEXCEPT
{
// Transaction commitment is required under checkpoint.
if (is_invalid_merkle_root())
return error::merkle_mismatch;
return error::invalid_transaction_commitment;

// type32_malleated is subset of is_internal_double_spend, assuming
// otherwise valid txs, as that will catch any duplicated transaction.
Expand All @@ -755,7 +755,7 @@ code block::check(bool bypass) const NOEXCEPT
if (is_internal_double_spend())
return error::block_internal_double_spend;
if (is_invalid_merkle_root())
return error::merkle_mismatch;
return error::invalid_transaction_commitment;

return check_transactions();
}
Expand Down
2 changes: 1 addition & 1 deletion src/error/block_error_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DEFINE_ERROR_T_MESSAGE_MAP(block_error)
{ internal_duplicate, "matching transaction hashes in block" },
{ block_internal_double_spend, "double spend internal to block" },
{ forward_reference, "transactions out of order" },
{ merkle_mismatch, "merkle root mismatch" },
{ invalid_transaction_commitment, "invalid transaction commitment" },
{ block_legacy_sigop_limit, "too many block legacy signature operations" },
{ type32_malleated, "block is type32 malleated" },

Expand Down
6 changes: 3 additions & 3 deletions test/error/block_error_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ BOOST_AUTO_TEST_CASE(block_error_t__code__forward_reference__true_exected_messag
BOOST_REQUIRE_EQUAL(ec.message(), "transactions out of order");
}

BOOST_AUTO_TEST_CASE(block_error_t__code__merkle_mismatch__true_exected_message)
BOOST_AUTO_TEST_CASE(block_error_t__code__invalid_transaction_commitment__true_exected_message)
{
constexpr auto value = error::merkle_mismatch;
constexpr auto value = error::invalid_transaction_commitment;
const auto ec = code(value);
BOOST_REQUIRE(ec);
BOOST_REQUIRE(ec == value);
BOOST_REQUIRE_EQUAL(ec.message(), "merkle root mismatch");
BOOST_REQUIRE_EQUAL(ec.message(), "invalid transaction commitment");
}

BOOST_AUTO_TEST_CASE(block_error_t__code__block_legacy_sigop_limit__true_exected_message)
Expand Down

0 comments on commit 16c1422

Please sign in to comment.