diff --git a/src/chasers/chaser_validate.cpp b/src/chasers/chaser_validate.cpp index 014dbe4c..f73a19be 100644 --- a/src/chasers/chaser_validate.cpp +++ b/src/chasers/chaser_validate.cpp @@ -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; diff --git a/src/protocols/protocol_block_in_31800.cpp b/src/protocols/protocol_block_in_31800.cpp index 23525148..d5afee49 100644 --- a/src/protocols/protocol_block_in_31800.cpp +++ b/src/protocols/protocol_block_in_31800.cpp @@ -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; }