Add isolated RandomX difficulty path
This commit is contained in:
parent
366b3d4a51
commit
fcfe8c1747
1 changed files with 18 additions and 2 deletions
20
src/pow.cpp
20
src/pow.cpp
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue