aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
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);