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
10 changes: 10 additions & 0 deletions src/chasers/chaser_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ code chaser_validate::validate(bool bypass, const chain::block& block,
if (!bypass)
{
code ec{};

// Skips identity validation (performed in downloader).
// This can be performed in donwnloader as well but moving it here with
// more order than required allows the downloader to avoid block parse
// which significantly reduces memory consumption and CPU during sync.
// This slightly increases check() computation under full validation
// because a redundant malleation guard is required when downloading.
if (((ec = block.check(false))) || ((ec = block.check(ctx, false))))
return ec;

if ((ec = block.accept(ctx, subsidy_interval_, initial_subsidy_)))
return ec;

Expand Down
15 changes: 4 additions & 11 deletions src/protocols/protocol_block_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,19 +363,12 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
// error::invalid_transaction_commitment is returned. Only identity is required
// under bypass. Header state is checked by organize.
code protocol_block_in_31800::check(const chain::block& block,
const chain::context& ctx, bool bypass) const NOEXCEPT
const chain::context& ctx, bool) const NOEXCEPT
{
code ec{};
if (bypass)
{
if (((ec = block.identify())) || ((ec = block.identify(ctx))))
return ec;
}
else
{
if (((ec = block.check())) || ((ec = block.check(ctx))))
return ec;
}

if (((ec = block.identify())) || ((ec = block.identify(ctx))))
return ec;

return error::success;
}
Expand Down
Loading