aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-10-10 23:07:44 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2013-10-11 23:25:50 +0200
commit4c6d41b8b653ef90639b1a32f6aab0bb1cef90c5 (patch)
tree3e29135e08fa64984cd47fdfeda42d55e7e51ad8 /src/miner.cpp
parentc74b6c3d8fcc1750fa0861ae851b353a7f3495d2 (diff)
downloadbitcoin-4c6d41b8b653ef90639b1a32f6aab0bb1cef90c5.tar.xz
Refactor/encapsulate chain globals into a CChain class
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp8
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