aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPatrick Lodder <[email protected]>2021-07-21 22:29:32 +0200
committerPatrick Lodder <[email protected]>2021-07-22 19:48:09 +0200
commit303be2e442744593d8211b520f9fe554b3bd31a2 (patch)
tree92b69f26c5f79f03344683ff1fc6642893ff0835 /src/net.cpp
parentMerge pull request #2413 from dogecoin/revert-2342-issue-2340-depends-build-d... (diff)
downloaddiscoin-303be2e442744593d8211b520f9fe554b3bd31a2.tar.xz
discoin-303be2e442744593d8211b520f9fe554b3bd31a2.zip
Reduce getheaders spam by serializing getheader requests per peer
Introduces a counter for getheader requests that have been sent to a peer but are pending response, reducing the number of parallel requests a node pushes out to its peers when needing to sync large amounts of headers. All getheader requests are serialized during initial sync, except when a non-connecting header is received, allowing the node to resolve issues with peers sending faulty blocks using the DoS mechanism, and when we get an inv for a block that we do not know, because it's possible we're only connected to legacy nodes that do not implement header announcement properly.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index e89f1b11d..2117c59fd 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2704,6 +2704,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
fPauseRecv = false;
fPauseSend = false;
nProcessQueueSize = 0;
+ nPendingHeaderRequests = 0;
BOOST_FOREACH(const std::string &msg, getAllNetMessageTypes())
mapRecvBytesPerMsgCmd[msg] = 0;