From c5eeb748078aa6129cf45ddbc4e075ac9bbcf56f Mon Sep 17 00:00:00 2001 From: Duke Date: Mon, 16 Sep 2024 11:06:31 -0400 Subject: [PATCH] Simplify MAX_BLOCK_SIZE Our code requires sapling activation at height 1 so we can simplify this function which should lead to some performance improvements since it is called from many places, including mining code. --- src/chainparams.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 02ab894a9..0b454e2c0 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -492,13 +492,14 @@ void UpdateNetworkUpgradeParameters(Consensus::UpgradeIndex idx, int nActivation int32_t MAX_BLOCK_SIZE(int32_t height) { - int32_t saplinght = pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight; + // this codebase requires sapling activation at height=1 + int32_t saplinght = 1; // pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight; //fprintf(stderr,"MAX_BLOCK_SIZE %d vs. %d\n",height,mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight); - if ( height <= 0 || (saplinght > 0 && height >= saplinght) ) - { + //if ( height <= 0 || (saplinght > 0 && height >= saplinght) ) + //{ return(_MAX_BLOCK_SIZE); - } - else return(2000000); + //} + //else return(2000000); } // Change the Hush blocktime at run-time(!)