mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
testing 2 year halving
This commit is contained in:
parent
9a984f12aa
commit
cb39adbebf
11
src/main.cpp
11
src/main.cpp
@ -1062,7 +1062,7 @@ uint256 static GetOrphanRoot(const CBlockHeader* pblock)
|
||||
return pblock->GetHash();
|
||||
}
|
||||
|
||||
int64 static GetBlockValue(int nBits, int64 nFees)
|
||||
int64 static GetBlockValue(int nBits, int nHeight, int64 nFees)
|
||||
{
|
||||
double dDiff =
|
||||
(double)0x0000ffff / (double)(nBits & 0x00ffffff);
|
||||
@ -1072,6 +1072,9 @@ int64 static GetBlockValue(int nBits, int64 nFees)
|
||||
if (nSubsidy < 1) nSubsidy = 1;
|
||||
nSubsidy *= COIN;
|
||||
|
||||
// Subsidy is cut in half every 840000 blocks, which will occur approximately every 2 years
|
||||
nSubsidy >>= (nHeight / 5); // XCoin: 840k blocks in ~2 years
|
||||
|
||||
return nSubsidy + nFees;
|
||||
}
|
||||
|
||||
@ -1698,8 +1701,8 @@ bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsVi
|
||||
if (fBenchmark)
|
||||
printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1));
|
||||
|
||||
if (vtx[0].GetValueOut() > GetBlockValue(pindex->pprev->nBits, nFees))
|
||||
return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->pprev->nBits, nFees)));
|
||||
if (vtx[0].GetValueOut() > GetBlockValue(pindex->pprev->nBits, pindex->nHeight, nFees))
|
||||
return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->pprev->nBits, pindex->nHeight, nFees)));
|
||||
|
||||
if (!control.Wait())
|
||||
return state.DoS(100, false);
|
||||
@ -4443,7 +4446,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
|
||||
float dDiff =
|
||||
(float)0x0000ffff / (float)(pindexPrev->nBits & 0x00ffffff);
|
||||
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nBits, nFees);
|
||||
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nBits, pindexPrev->nHeight, nFees);
|
||||
|
||||
pblocktemplate->vTxFees[0] = -nFees;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user