RandomX interval and block lag are consensus changes and will never change at run-time, so they can be static

This commit is contained in:
Duke
2024-01-06 23:47:00 -08:00
parent 447f1f50f3
commit 4054140b21

View File

@@ -1058,6 +1058,9 @@ enum RandomXSolverCancelCheck
Reason2
};
int GetRandomXInterval() { return GetArg("-ac_randomx_interval",1024); }
int GetRandomXBlockLag() { return GetArg("-ac_randomx_lag", 64); }
#ifdef ENABLE_WALLET
void static RandomXMiner(CWallet *pwallet)
#else
@@ -1131,9 +1134,9 @@ void static RandomXMiner()
// With the defaults of 1024 and 64
// the key block will change every ~21.3 hours with a 75s block time
// and every ~17 hours with the default 60s block time for HSCs
int randomxInterval = GetArg("-ac_randomx_interval",1024);
static int randomxInterval = GetRandomXInterval();
// This lag is 80 mins for 75s blocktime and 64 mins for 60s (default) blocktime for HSCs
int randomxBlockLag = GetArg("-ac_randomx_lag", 64);
static int randomxBlockLag = GetRandomXBlockLag();
randomx_vm *myVM = nullptr;
try {