Merge branch 'duke' of https://git.hush.is/hush/hush3 into duke

This commit is contained in:
Duke
2024-09-20 13:43:15 -04:00
2 changed files with 23 additions and 32 deletions

View File

@@ -222,24 +222,6 @@ void CChainParams::SetCheckpointData(CChainParams::CCheckpointData checkpointDat
CChainParams::checkpointData = checkpointData; CChainParams::checkpointData = checkpointData;
} }
/*
To change the max block size, all that needs to be updated is the #define _MAX_BLOCK_SIZE in utils.h
However, doing that without any other changes will allow forking non-updated nodes by creating a larger block. So, make sure to height activate the new blocksize properly.
Assuming it is 8MB, then:
#define _OLD_MAX_BLOCK_SIZE (4096 * 1024)
#define _MAX_BLOCK_SIZE (2 * 4096 * 1024)
change the body of if:
{
if ( height < saplinght+1000000 ) // activates 8MB blocks 1 million blocks after saplinght
return(_OLD_MAX_BLOCK_SIZE);
else return(_MAX_BLOCK_SIZE);
}
*/
// Unused Testnet, for completeness. We make testcoins instead. // Unused Testnet, for completeness. We make testcoins instead.
class CTestNetParams : public CChainParams { class CTestNetParams : public CChainParams {
public: public:
@@ -490,16 +472,27 @@ void UpdateNetworkUpgradeParameters(Consensus::UpgradeIndex idx, int nActivation
regTestParams.UpdateNetworkUpgradeParameters(idx, nActivationHeight); regTestParams.UpdateNetworkUpgradeParameters(idx, nActivationHeight);
} }
/*
To change the max block size, all that needs to be updated is the #define _MAX_BLOCK_SIZE in utils.h
However, doing that without any other changes will allow forking non-updated nodes by creating a larger block. So, make sure to height activate the new blocksize properly.
Assuming it is 8MB, then:
#define _OLD_MAX_BLOCK_SIZE (4096 * 1024)
#define _MAX_BLOCK_SIZE (2 * 4096 * 1024)
change the body of MAX_BLOCK_SIZE() function to
{
if ( height < saplinght+1000000 ) // activates 8MB blocks 1 million blocks after saplinght
return(_OLD_MAX_BLOCK_SIZE);
else return(_MAX_BLOCK_SIZE);
}
*/
int32_t MAX_BLOCK_SIZE(int32_t height) int32_t MAX_BLOCK_SIZE(int32_t height)
{ {
// 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) )
//{
return(_MAX_BLOCK_SIZE); return(_MAX_BLOCK_SIZE);
//}
//else return(2000000);
} }
// Change the Hush blocktime at run-time(!) // Change the Hush blocktime at run-time(!)

View File

@@ -1321,8 +1321,7 @@ void static RandomXMiner()
} }
CValidationState state; CValidationState state;
{ LOCK(cs_main); //{ LOCK(cs_main);
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false)) if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
{ {
h = UintToArith256(B.GetHash()); h = UintToArith256(B.GetHash());
@@ -1333,8 +1332,7 @@ void static RandomXMiner()
fprintf(stderr,"\n"); fprintf(stderr,"\n");
return(false); return(false);
} }
//}
}
SetThreadPriority(THREAD_PRIORITY_NORMAL); SetThreadPriority(THREAD_PRIORITY_NORMAL);
LogPrintf("HushRandomXMiner:\n"); LogPrintf("HushRandomXMiner:\n");
LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", B.GetHash().GetHex(), HASHTarget.GetHex()); LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", B.GetHash().GetHex(), HASHTarget.GetHex());
@@ -1693,8 +1691,8 @@ void static BitcoinMiner()
fprintf(stderr," mined %s block %d!\n",SMART_CHAIN_SYMBOL,Mining_height); fprintf(stderr," mined %s block %d!\n",SMART_CHAIN_SYMBOL,Mining_height);
} }
CValidationState state; CValidationState state;
{ LOCK(cs_main);
//{ LOCK(cs_main);
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false)) if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
{ {
h = UintToArith256(B.GetHash()); h = UintToArith256(B.GetHash());
@@ -1705,7 +1703,7 @@ void static BitcoinMiner()
return(false); return(false);
} }
} //}
HUSH_CHOSEN_ONE = 1; HUSH_CHOSEN_ONE = 1;
// Found a solution // Found a solution
SetThreadPriority(THREAD_PRIORITY_NORMAL); SetThreadPriority(THREAD_PRIORITY_NORMAL);