aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-08-12 10:55:47 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-08-12 11:21:10 +0200
commita38a98c47667ca2e6506603f49ce4d455eec1a78 (patch)
treece110406999ae7dc596994ec94d3244e4305e43b /src
parenta63e86e01d6fa340f250202b9e22e09e85d8a0d2 (diff)
parentf0c2915f66ade456c9d7847ea64fef09e1a12975 (diff)
Merge pull request #4603
f0c2915 Simplify and rename CheckWork to ProcessBlockFound (jtimon)
Diffstat (limited to 'src')
-rw-r--r--src/miner.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index ec56c71192..9408d2c5aa 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -402,17 +402,8 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
return CreateNewBlock(scriptPubKey);
}
-bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
+bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
{
- uint256 hash = pblock->GetHash();
- uint256 hashTarget = uint256().SetCompact(pblock->nBits);
-
- if (hash > hashTarget)
- return false;
-
- //// debug print
- LogPrintf("BitcoinMiner:\n");
- LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex(), hashTarget.GetHex());
pblock->print();
LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue));
@@ -500,7 +491,9 @@ void static BitcoinMiner(CWallet *pwallet)
assert(hash == pblock->GetHash());
SetThreadPriority(THREAD_PRIORITY_NORMAL);
- CheckWork(pblock, *pwallet, reservekey);
+ LogPrintf("BitcoinMiner:\n");
+ LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex(), hashTarget.GetHex());
+ ProcessBlockFound(pblock, *pwallet, reservekey);
SetThreadPriority(THREAD_PRIORITY_LOWEST);
// In regression test mode, stop mining after a block is found.