mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Add ability to calculate only superblock part of subsidy in GetBlockSubsidy()
This commit is contained in:
parent
e8f9e5d406
commit
51434cfff5
@ -1739,7 +1739,7 @@ NOTE: unlike bitcoin we are using PREVIOUS block height here,
|
||||
might be a good idea to change this to use prev bits
|
||||
but current height to avoid confusion.
|
||||
*/
|
||||
CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params& consensusParams)
|
||||
CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params& consensusParams, bool fSuperblockPartOnly)
|
||||
{
|
||||
double dDiff = (double)0x0000ffff / (double)(nPrevBits & 0x00ffffff);
|
||||
|
||||
@ -1771,9 +1771,9 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params&
|
||||
for(int i = consensusParams.nSubsidyHalvingInterval; i <= nPrevHeight; i += consensusParams.nSubsidyHalvingInterval) nSubsidy -= nSubsidy/14;
|
||||
|
||||
// Hard fork to reduce the block reward by 10 extra percent (allowing budget super-blocks)
|
||||
if(nPrevHeight > consensusParams.nBudgetPaymentsStartBlock) nSubsidy -= nSubsidy/10;
|
||||
CAmount nSuperblockPart = (nPrevHeight > consensusParams.nBudgetPaymentsStartBlock) ? nSubsidy/10 : 0;
|
||||
|
||||
return nSubsidy;
|
||||
return fSuperblockPartOnly ? nSuperblockPart : nSubsidy - nSuperblockPart;
|
||||
}
|
||||
|
||||
CAmount GetMasternodePayment(int nHeight, CAmount blockValue)
|
||||
|
@ -254,7 +254,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &tx, const Consensus::Para
|
||||
/** Find the best known block, and make it the tip of the block chain */
|
||||
bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams, const CBlock* pblock = NULL);
|
||||
int64_t GetTotalCoinEstimate(int nHeight);
|
||||
CAmount GetBlockSubsidy(int nBits, int nHeight, const Consensus::Params& consensusParams);
|
||||
CAmount GetBlockSubsidy(int nBits, int nHeight, const Consensus::Params& consensusParams, bool fSuperblockPartOnly = false);
|
||||
|
||||
// ***TODO***
|
||||
double ConvertBitsToDouble(unsigned int nBits);
|
||||
|
Loading…
Reference in New Issue
Block a user