From 5712825cedce9551684460aeb98c0d1f2a6ccfbe Mon Sep 17 00:00:00 2001 From: Capri Date: Thu, 17 Sep 2026 21:18:08 +0000 Subject: [PATCH] Set RandomX mainnet activation height --- src/chainparams.cpp | 2 +- src/test/pow_tests.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index a48356b..21c41f8 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -183,7 +183,7 @@ public: consensus.asertActivationHeight = 6500; consensus.asertHalfLife = 2 * 24 * 60 * 60; consensus.fastRiseActivationHeight = std::numeric_limits::max(); - consensus.randomXActivationHeight = std::numeric_limits::max(); + consensus.randomXActivationHeight = 8099; consensus.randomXInitialTarget = uint256S("000000359bc10000000000000000000000000000000000000000000000000000"); consensus.multiAlgoChainworkScaleNumerator = 1921821664; consensus.multiAlgoChainworkScaleDenominator = 41733; diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index 05c78a4..79869c3 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -488,13 +488,20 @@ BOOST_AUTO_TEST_CASE(MultiAlgo_mainnet_chainwork_scale_test) BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test) { const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN); + auto consensus = chainParams->GetConsensus(); + + // This is a legacy equivalent-time test over synthetic SHA-only blocks. + // Keep multi-algo activation outside the synthetic height range so the + // test remains independent of the configured mainnet activation height. + consensus.randomXActivationHeight = std::numeric_limits::max(); + std::vector blocks(10000); for (int i = 0; i < 10000; i++) { blocks[i].pprev = i ? &blocks[i - 1] : nullptr; blocks[i].nHeight = i; blocks[i].nVersion = 1; - blocks[i].nTime = 1269211443 + i * chainParams->GetConsensus().nPowTargetSpacing; + blocks[i].nTime = 1269211443 + i * consensus.nPowTargetSpacing; blocks[i].nBits = 0x207fffff; /* target 0x7fffff000... */ blocks[i].nChainWork = i ? blocks[i - 1].nChainWork + GetBlockProof(blocks[i - 1]) : arith_uint256(0); @@ -511,7 +518,7 @@ BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test) CBlockIndex *p2 = &blocks[InsecureRandRange(10000)]; CBlockIndex *p3 = &blocks[InsecureRandRange(10000)]; - int64_t tdiff = GetBlockProofEquivalentTime(*p1, *p2, *p3, chainParams->GetConsensus()); + int64_t tdiff = GetBlockProofEquivalentTime(*p1, *p2, *p3, consensus); BOOST_CHECK_EQUAL(tdiff, p1->GetBlockTime() - p2->GetBlockTime()); }