randomx validation enforcement with activation height

This commit is contained in:
dan_s
2026-02-17 16:43:41 -06:00
parent 74d66d8bf2
commit 0da68ebbc7
9 changed files with 166 additions and 5 deletions

View File

@@ -1011,8 +1011,8 @@ enum RandomXSolverCancelCheck
Reason2
};
int GetRandomXInterval() { return GetArg("-ac_randomx_interval",1024); }
int GetRandomXBlockLag() { return GetArg("-ac_randomx_lag", 64); }
int GetRandomXInterval();
int GetRandomXBlockLag();
#ifdef ENABLE_WALLET
void static RandomXMiner(CWallet *pwallet)
@@ -1268,16 +1268,17 @@ void static RandomXMiner()
arith_uint256 hashTarget;
hashTarget = HASHTarget;
CRandomXInput rxInput(pblocktemplate->block);
CDataStream randomxInput(SER_NETWORK, PROTOCOL_VERSION);
// Use the current block as randomx input
randomxInput << pblocktemplate->block;
// Serialize block header without nSolution but with nNonce for deterministic RandomX input
randomxInput << rxInput;
// std::cerr << "RandomXMiner: randomxInput=" << HexStr(randomxInput) << "\n";
// fprintf(stderr,"RandomXMiner: created randomxKey=%s , randomxInput.size=%lu\n", randomxKey, randomxInput.size() ); //randomxInput);
rxdebug("%s: randomxKey=%s randomxInput=%s\n", randomxKey, HexStr(randomxInput).c_str());
rxdebug("%s: calculating randomx hash\n");
randomx_calculate_hash(myVM, &randomxInput, sizeof randomxInput, randomxHash);
randomx_calculate_hash(myVM, &randomxInput[0], randomxInput.size(), randomxHash);
rxdebug("%s: calculated randomx hash\n");
rxdebug("%s: randomxHash=");