From 18a804c09cc53b8bb946edd5e5f16ef5ec220b73 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Fri, 16 Nov 2018 09:02:36 -0500 Subject: [PATCH] CreateNewBlock: Only do signed block stuff when active --- src/miner.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 3c96e4aa9f..03353692a4 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -143,13 +143,14 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc // transaction (which in most cases can be a no-op). fIncludeWitness = IsWitnessEnabled(pindexPrev, chainparams.GetConsensus()) && fMineWitnessTx; - // Pad block weight by block proof fields (including upper-bound of signature) - nBlockWeight += chainparams.GetConsensus().signblockscript.size() * WITNESS_SCALE_FACTOR; - nBlockWeight += chainparams.GetConsensus().max_block_signature_size * WITNESS_SCALE_FACTOR; - - // Reset block proof - ResetProof(*pblock); - ResetChallenge(*pblock, *pindexPrev, chainparams.GetConsensus()); + if (g_signed_blocks) { + // Pad block weight by block proof fields (including upper-bound of signature) + nBlockWeight += chainparams.GetConsensus().signblockscript.size() * WITNESS_SCALE_FACTOR; + nBlockWeight += chainparams.GetConsensus().max_block_signature_size * WITNESS_SCALE_FACTOR; + // Reset block proof + ResetProof(*pblock); + ResetChallenge(*pblock, *pindexPrev, chainparams.GetConsensus()); + } int nPackagesSelected = 0; int nDescendantsUpdated = 0;