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.
This commit is contained in:
Duke
2024-09-16 11:06:31 -04:00
parent 912942f2a8
commit c5eeb74807

View File

@@ -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(!)