aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJeff Garzik <[email protected]>2012-09-24 13:26:09 -0400
committerJeff Garzik <[email protected]>2012-09-24 13:26:09 -0400
commit93dd68e924c7cf24b75bfb5b83b1be1cdc27dbdc (patch)
treeaa6e515580098597bbf5340ad534253048ca545e /src/main.cpp
parentMerge branch 'testdata' of git://github.com/TheBlueMatt/bitcoin (diff)
downloaddiscoin-93dd68e924c7cf24b75bfb5b83b1be1cdc27dbdc.tar.xz
discoin-93dd68e924c7cf24b75bfb5b83b1be1cdc27dbdc.zip
P2P: Do not request blocks from peers with fewer blocks than us
If the remote node has a shorter chain, do not waste our special getblocks request on them.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fbaf05dfc..206d85e53 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2513,6 +2513,7 @@ 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 &&
+ (pfrom->nStartingHeight > (nBestHeight - 144)) &&
(pfrom->nVersion < NOBLKS_VERSION_START ||
pfrom->nVersion >= NOBLKS_VERSION_END) &&
(nAskedForBlocks < 1 || vNodes.size() <= 1))