From 218e2ea91210fd6fa9149dcac16ec172226b09fb Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Wed, 21 Aug 2013 12:30:32 -0400 Subject: [PATCH] Don't waste work on slow peers until they catch up --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index a90af4898..06fea7446 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3068,6 +3068,12 @@ void static ProcessGetData(CNode* pfrom) if (pfrom->nSendSize >= SendBufferSize()) break; + // Don't waste work on slow peers until they catch up on the blocks we + // give them. 80 bytes is just the size of a block header - obviously + // the minimum we might return. + if (pfrom->nBlocksRequested * 80 > pfrom->nSendBytes) + break; + const CInv &inv = *it; { boost::this_thread::interruption_point();