From a8879fb7a456684dc607bccc3b57522f673fd363 Mon Sep 17 00:00:00 2001 From: svost Date: Mon, 7 Feb 2022 20:51:44 +0300 Subject: [PATCH] Move out fees from base pow reward --- src/main.cpp | 6 +++--- src/main.h | 2 +- src/miner.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 27937eb..7925ce1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1009,7 +1009,7 @@ CBigNum inline GetProofOfStakeLimit(int nHeight, unsigned int nTime) } // miner's coin base reward based on nBits -int64_t GetProofOfWorkReward(unsigned int nBits, int64_t nFees) +int64_t GetProofOfWorkReward(unsigned int nBits) { CBigNum bnSubsidyLimit = MAX_MINT_PROOF_OF_WORK; @@ -1044,7 +1044,7 @@ int64_t GetProofOfWorkReward(unsigned int nBits, int64_t nFees) if (fDebug && GetBoolArg("-printcreation")) printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%" PRId64 "\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy); - return min(nSubsidy, MAX_MINT_PROOF_OF_WORK) + nFees; + return min(nSubsidy, MAX_MINT_PROOF_OF_WORK); } // miner's coin stake reward based on nBits and coin age spent (coin-days) @@ -1765,7 +1765,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck) if (IsProofOfWork()) { - int64_t nBlockReward = GetProofOfWorkReward(nBits, nFees); + int64_t nBlockReward = GetProofOfWorkReward(nBits) + nFees; // Check coinbase reward if (vtx[0].GetValueOut() > nBlockReward) diff --git a/src/main.h b/src/main.h index 91faf48..b75dd8d 100644 --- a/src/main.h +++ b/src/main.h @@ -122,7 +122,7 @@ void ThreadScriptCheckQuit(); bool CheckProofOfWork(uint256 hash, unsigned int nBits); unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake); -int64_t GetProofOfWorkReward(unsigned int nBits, int64_t nFees=0); +int64_t GetProofOfWorkReward(unsigned int nBits); int64_t GetProofOfStakeReward(int64_t nCoinAge, unsigned int nBits, int64_t nTime, bool bCoinYearOnly=false); unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime); unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime); diff --git a/src/miner.cpp b/src/miner.cpp index 37afda3..4818e4c 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -359,7 +359,7 @@ std::shared_ptr CreateNewBlock(CWallet* pwallet, CTransaction *txCoinSta if (!fProofOfStake) { - pblock->vtx[0].vout[0].nValue = GetProofOfWorkReward(pblock->nBits, nFees); + pblock->vtx[0].vout[0].nValue = GetProofOfWorkReward(pblock->nBits) + nFees; if (fDebug) printf("CreateNewBlock(): PoW reward %" PRIu64 "\n", pblock->vtx[0].vout[0].nValue); -- 1.7.1