aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
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.h
parentMerge pull request #2413 from dogecoin/revert-2342-issue-2340-depends-build-d... (diff)
downloadarchived-discoin-303be2e442744593d8211b520f9fe554b3bd31a2.tar.xz
archived-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.h')
-rw-r--r--src/net.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index 868be7fd9..f5841a314 100644
--- a/src/net.h
+++ b/src/net.h
@@ -681,6 +681,9 @@ public:
CAmount lastSentFeeFilter;
int64_t nextSendTimeFeeFilter;
+ // Counts getheaders requests sent to this peer
+ std::atomic<int64_t> nPendingHeaderRequests;
+
// Alert relay
std::vector<CAlert> vAlertToSend;