diff options
| author | Patrick Lodder <[email protected]> | 2015-07-20 15:03:02 +0200 |
|---|---|---|
| committer | Patrick Lodder <[email protected]> | 2015-07-20 15:03:02 +0200 |
| commit | 8cd835cddba565594f5cde2d91ee92e32bcbf2fd (patch) | |
| tree | 049698b334daf7e65af268b0da64134fd9dbbfdc /src/miner.cpp | |
| parent | Merge pull request #1200 from rnicoll/1.10-auxpow-clean (diff) | |
| parent | Update Python test address and key values to match Dogecoin format. (diff) | |
| download | discoin-8cd835cddba565594f5cde2d91ee92e32bcbf2fd.tar.xz discoin-8cd835cddba565594f5cde2d91ee92e32bcbf2fd.zip | |
Merge pull request #1201 from rnicoll/1.10-sync
Consensus fixes
Diffstat (limited to 'src/miner.cpp')
| -rw-r--r-- | src/miner.cpp | 12 |
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); |