Add isolated RandomX difficulty path

This commit is contained in:
Capri 2026-09-12 21:34:53 +00:00
commit fcfe8c1747
Signed by: VextaProject
SSH key fingerprint: SHA256:739BZv8LvIDY2tR7lXLy/IQ6MaGTQtYcG9GNvCjmpVM

View file

@ -147,8 +147,24 @@ static unsigned int ApplyFastRiseProtection(
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params, int algo) unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params, int algo)
{ {
(void)algo; if (algo == ALGO_RANDOMX) {
// Vexta is SHA256D-only. const CBlockIndex* pindexPrevAlgo =
GetLastBlockIndexForAlgoFast(pindexLast, ALGO_RANDOMX);
if (pindexPrevAlgo == nullptr) {
return InitialDifficulty(params);
}
// RandomX will get its own per-algo retarget logic here.
// For now, preserve the last RandomX difficulty.
return pindexPrevAlgo->nBits;
}
if (algo != ALGO_SHA256D) {
return InitialDifficulty(params);
}
// Existing SHA256D difficulty logic below remains unchanged.
if (pindexLast == nullptr) { if (pindexLast == nullptr) {
return InitialDifficulty(params); return InitialDifficulty(params);
} }