aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorjtimon <jtimon@blockstream.io>2014-10-10 11:19:36 +0200
committerjtimon <jtimon@jtimon.cc>2015-01-04 21:04:55 +0100
commit0cc0d8d60b8aec483a926a94aa7f85b9b0d0aca3 (patch)
tree3b60894705a098855587ca51582f183fe8711ab2 /src/miner.cpp
parent41cced21063a89992ef393dda4fffc44ff60c7c3 (diff)
downloadbitcoin-0cc0d8d60b8aec483a926a94aa7f85b9b0d0aca3.tar.xz
Get rid of the internal miner's hashmeter
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index ad29431421..cf384bb7b5 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -364,8 +364,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
//
// Internal miner
//
-double dHashesPerSec = 0.0;
-int64_t nHPSTimerStart = 0;
//
// ScanHash scans nonces looking for a hash with at least some zero bits.
@@ -395,10 +393,8 @@ bool static ScanHash(const CBlockHeader *pblock, uint32_t& nNonce, uint256 *phas
return true;
// If nothing found after trying for a while, return -1
- if ((nNonce & 0xffff) == 0)
- return false;
if ((nNonce & 0xfff) == 0)
- boost::this_thread::interruption_point();
+ return false;
}
}
@@ -485,14 +481,9 @@ void static BitcoinMiner(CWallet *pwallet)
uint256 hashTarget = uint256().SetCompact(pblock->nBits);
uint256 hash;
uint32_t nNonce = 0;
- uint32_t nOldNonce = 0;
while (true) {
- bool fFound = ScanHash(pblock, nNonce, &hash);
- uint32_t nHashesDone = nNonce - nOldNonce;
- nOldNonce = nNonce;
-
// Check if something found
- if (fFound)
+ if (ScanHash(pblock, nNonce, &hash))
{
if (hash <= hashTarget)
{
@@ -514,35 +505,6 @@ void static BitcoinMiner(CWallet *pwallet)
}
}
- // Meter hashes/sec
- static int64_t nHashCounter;
- if (nHPSTimerStart == 0)
- {
- nHPSTimerStart = GetTimeMillis();
- nHashCounter = 0;
- }
- else
- nHashCounter += nHashesDone;
- if (GetTimeMillis() - nHPSTimerStart > 4000)
- {
- static CCriticalSection cs;
- {
- LOCK(cs);
- if (GetTimeMillis() - nHPSTimerStart > 4000)
- {
- dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nHPSTimerStart);
- nHPSTimerStart = GetTimeMillis();
- nHashCounter = 0;
- static int64_t nLogTime;
- if (GetTime() - nLogTime > 30 * 60)
- {
- nLogTime = GetTime();
- LogPrintf("hashmeter %6.0f khash/s\n", dHashesPerSec/1000.0);
- }
- }
- }
- }
-
// Check for stop or if block needs to be rebuilt
boost::this_thread::interruption_point();
// Regtest mode doesn't require peers