aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-12-11 16:49:21 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-12-11 16:49:21 +0000
commit4ea3f3da1a0c00ea74e85c31a22ea94d18bbdf06 (patch)
tree4f9bb0b8598035b704a8abe08a292e8465e7c1c6 /main.cpp
parentb075bbf9862df41cdf5265026ba787b7d0fecb07 (diff)
retry IRC if name in use,
resize to fit ubuntu's giant default font, scroll debug.log, pause gen during initial block download git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@44 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index 46e7475246..cb93e5486f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2530,7 +2530,7 @@ void BitcoinMiner()
//
// Search
//
- unsigned int nStart = GetTime();
+ int64 nStart = GetTime();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hash;
loop
@@ -2582,14 +2582,27 @@ void BitcoinMiner()
return;
if (fLimitProcessors && vnThreadsRunning[3] > nLimitProcessors)
return;
- if (tmp.block.nNonce == 0)
+ if (vNodes.empty())
break;
- if (pindexPrev != pindexBest)
+ if (tmp.block.nNonce == 0)
break;
if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
break;
- if (vNodes.empty())
+ if (pindexPrev != pindexBest)
+ {
+ // Pause generating during initial download
+ if (GetTime() - nStart < 20)
+ {
+ CBlockIndex* pindexTmp;
+ do
+ {
+ pindexTmp = pindexBest;
+ Sleep(10000);
+ }
+ while (pindexTmp != pindexBest);
+ }
break;
+ }
tmp.block.nTime = pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
}
}