aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2013-04-09 10:51:06 -0700
committerGavin Andresen <[email protected]>2013-04-09 10:51:06 -0700
commit1fd3ed25be95f79980b03c2ee36f72aea82baa4d (patch)
tree8a6a18ba0a33d17c05d7b1d2b70898cc32e88f21 /src/main.cpp
parentnet.cpp: Do not change primary process name from (default) to "bitcoin-start" (diff)
parentAdd bytessent, bytesrecv and syncnode to getpeerinfo (diff)
downloaddiscoin-1fd3ed25be95f79980b03c2ee36f72aea82baa4d.tar.xz
discoin-1fd3ed25be95f79980b03c2ee36f72aea82baa4d.zip
Merge pull request #2461 from sipa/syncnode
Make sure we always have a node to do IBD from
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7f408c4d1..06957ba52 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3235,18 +3235,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
}
}
- // Ask the first connected node for block updates
- static int nAskedForBlocks = 0;
- if (!pfrom->fClient && !pfrom->fOneShot && !fImporting && !fReindex &&
- (pfrom->nStartingHeight > (nBestHeight - 144)) &&
- (pfrom->nVersion < NOBLKS_VERSION_START ||
- pfrom->nVersion >= NOBLKS_VERSION_END) &&
- (nAskedForBlocks < 1 || vNodes.size() <= 1))
- {
- nAskedForBlocks++;
- pfrom->PushGetBlocks(pindexBest, uint256(0));
- }
-
// Relay alerts
{
LOCK(cs_mapAlerts);
@@ -3855,6 +3843,12 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
pto->PushMessage("ping");
}
+ // Start block sync
+ if (pto->fStartSync && !fImporting && !fReindex) {
+ pto->fStartSync = false;
+ pto->PushGetBlocks(pindexBest, uint256(0));
+ }
+
// Resend wallet transactions that haven't gotten in a block yet
// Except during reindex, importing and IBD, when old wallet
// transactions become unconfirmed and spams other nodes.