Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/chasers/chaser_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,16 @@ code chaser_transaction::validate(const chain::transaction& tx) NOEXCEPT
code ec{};

// Ensure tx does not violate tx consensus rules.
// Guards ensure tx does not violate presumed block consensus rules.
// These are DoS guards when validating a tx outside of a block.
if (!ec) ec = tx.check();
if (!ec) ec = tx.check(pool_);
if (!ec) archive().populate_with_metadata(tx, true, true);
if (!ec) ec = tx.accept(pool_);

// Ensure tx does not violate presumed block consensus rules.
// This is a DoS guard when validating a tx outside of a block.
if (!ec) ec = tx.check_guard();
if (!ec) ec = tx.check_guard(pool_);

// Store population follows all checks that do not require it.
if (!ec) archive().populate_with_metadata(tx, true, true);
if (!ec) ec = tx.accept(pool_);
if (!ec) ec = tx.accept_guard(pool_);
if (!ec) ec = tx.confirm_guard(pool_);

Expand Down
4 changes: 2 additions & 2 deletions src/protocols/protocol_block_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
code protocol_block_in_31800::identify(const chain::view::block& block,
const chain::context& ctx, bool bypass) const NOEXCEPT
{
if (const auto ec = block.identify())
if (const auto ec = block.check_guard())
return ec;

// Bypass witness commitment check for stripped blocks.
if (bypass && node_pruned_)
return error::success;

if (const auto ec = block.identify(ctx))
if (const auto ec = block.check_guard(ctx))
return ec;

return error::success;
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/protocol_header_in_70014.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ void protocol_header_in_70014::identify(const gate_t::ptr& gate) NOEXCEPT
wtxids.cbegin());

const auto witness_root = sha256::merkle_root(std::move(wtxids));
if ((ec = chain::block::identify(root, txids, is_malleated64(block))) ||
(ec = chain::block::identify(ctx, first, witness_root, segregated)))
if ((ec = chain::block::check_guard(root, txids, is_malleated64(block))) ||
(ec = chain::block::check_guard(ctx, first, witness_root, segregated)))
{
LOGR("Compact block [" << encode_hash(block.hash) << "] from ["
<< opposite() << "] " << ec.message());
Expand Down
Loading