From 7afa01544325f954f81be5fe62d2dab2f1520be9 Mon Sep 17 00:00:00 2001 From: "Nate I." Date: Thu, 25 Jun 2026 07:59:18 +0300 Subject: [PATCH] Fix premine reward height validation --- src/main.cpp | 2 +- src/test/main_tests.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 90d9db3..532aae9 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -2612,7 +2612,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime1 - nTimeStart) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart) / (nInputs - 1), nTimeConnect * 0.000001); //PoW phase redistributed fees to miner. PoS stage destroys fees. - CAmount nExpectedMint = GetBlockValue(pindex->pprev->nHeight); + CAmount nExpectedMint = GetBlockValue(pindex->nHeight); if (block.IsProofOfWork()) nExpectedMint += nFees; diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 57ca8bb..4138d95 100755 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -21,6 +21,10 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test) nSubsidy = GetBlockValue(1); BOOST_CHECK_EQUAL(nSubsidy, 5000000 * COIN); + // Block 2 and later regular blocks return the standard reward. + nSubsidy = GetBlockValue(2); + BOOST_CHECK_EQUAL(nSubsidy, 10 * COIN); + nSubsidy = GetBlockValue(10000); BOOST_CHECK_EQUAL(nSubsidy, 10 * COIN);