Merge pull request #4603

f0c2915 Simplify and rename CheckWork to ProcessBlockFound (jtimon)
This commit is contained in:
Wladimir J. van der Laan 2014-08-12 10:55:47 +02:00
commit a38a98c476
No known key found for this signature in database
GPG key ID: 74810B012346C9A6

View file

@ -402,17 +402,8 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
return CreateNewBlock(scriptPubKey); 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(); pblock->print();
LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue)); LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue));
@ -500,7 +491,9 @@ void static BitcoinMiner(CWallet *pwallet)
assert(hash == pblock->GetHash()); assert(hash == pblock->GetHash());
SetThreadPriority(THREAD_PRIORITY_NORMAL); 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); SetThreadPriority(THREAD_PRIORITY_LOWEST);
// In regression test mode, stop mining after a block is found. // In regression test mode, stop mining after a block is found.