aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2015-07-09 22:06:41 +0100
committerRoss Nicoll <[email protected]>2015-07-19 16:42:22 +0000
commit949b1ccd88ff13c74a3c1a7b9faa7f36c1085904 (patch)
tree378278514e847511b46e5f8d67fd6e3a61e80fe7 /src/miner.cpp
parentMerge pull request #1200 from rnicoll/1.10-auxpow-clean (diff)
downloaddiscoin-949b1ccd88ff13c74a3c1a7b9faa7f36c1085904.tar.xz
discoin-949b1ccd88ff13c74a3c1a7b9faa7f36c1085904.zip
Modify chain consensus parameters to be height aware
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index f83f43ceb..70968ee50 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -328,15 +328,16 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
LogPrintf("CreateNewBlock(): total size %u\n", nBlockSize);
// Compute final coinbase transaction.
- txNew.vout[0].nValue = nFees + GetDogecoinBlockSubsidy(nHeight, chainparams.GetConsensus(), pindexPrev->GetBlockHash());
+ const Consensus::Params &consensus = chainparams.GetConsensus(nHeight);
+ txNew.vout[0].nValue = nFees + GetDogecoinBlockSubsidy(nHeight, consensus, pindexPrev->GetBlockHash());
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0;
pblock->vtx[0] = txNew;
pblocktemplate->vTxFees[0] = -nFees;
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
- UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
- pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
+ UpdateTime(pblock, consensus, pindexPrev);
+ pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensus);
pblock->nNonce = 0;
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
@@ -482,6 +483,7 @@ void static BitcoinMiner(CWallet *pwallet)
//
unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrev = chainActive.Tip();
+ const Consensus::Params &consensus = Params().GetConsensus(pindexPrev -> nHeight + 1);
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
if (!pblocktemplate.get())
@@ -540,8 +542,8 @@ void static BitcoinMiner(CWallet *pwallet)
break;
// Update nTime every few seconds
- UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
- if (chainparams.GetConsensus().fPowAllowMinDifficultyBlocks)
+ UpdateTime(pblock, consensus, pindexPrev);
+ if (consensus.fPowAllowMinDifficultyBlocks)
{
// Changing pblock->nTime can change work required on testnet:
hashTarget.SetCompact(pblock->nBits);