diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-10-14 20:39:00 -0700 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-10-14 20:39:00 -0700 |
commit | b9beea6e9d0f789f11d249b040e549d535bdc295 (patch) | |
tree | e87c3422b52b1f6d78b88b9cea756c1f3cb8d37b /src/miner.cpp | |
parent | ae6601872be4065f90713b9b6ef07e9883afec79 (diff) | |
parent | 4c6d41b8b653ef90639b1a32f6aab0bb1cef90c5 (diff) |
Merge pull request #3077 from sipa/chain
Refactor/encapsulate chain globals into a CChain class
Diffstat (limited to 'src/miner.cpp')
-rw-r--r-- | src/miner.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/miner.cpp b/src/miner.cpp index 30c600071f..e9c1d9aff9 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -176,7 +176,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) int64 nFees = 0; { LOCK2(cs_main, mempool.cs); - CBlockIndex* pindexPrev = pindexBest; + CBlockIndex* pindexPrev = chainActive.Tip(); CCoinsViewCache view(*pcoinsTip, true); // Priority order to process transactions @@ -467,7 +467,7 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) // Found a solution { LOCK(cs_main); - if (pblock->hashPrevBlock != hashBestChain) + if (pblock->hashPrevBlock != chainActive.Tip()->GetBlockHash()) return error("BitcoinMiner : generated block is stale"); // Remove key from key pool @@ -510,7 +510,7 @@ void static BitcoinMiner(CWallet *pwallet) // Create new block // unsigned int nTransactionsUpdatedLast = nTransactionsUpdated; - CBlockIndex* pindexPrev = pindexBest; + CBlockIndex* pindexPrev = chainActive.Tip(); auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey)); if (!pblocktemplate.get()) @@ -613,7 +613,7 @@ void static BitcoinMiner(CWallet *pwallet) break; if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60) break; - if (pindexPrev != pindexBest) + if (pindexPrev != chainActive.Tip()) break; // Update nTime every few seconds |