Skip to content

Commit

Permalink
Sugarchain: fix: do not disconnect whitelisted peers during IBD (#80)
Browse files Browse the repository at this point in the history
+comment cleanup
  • Loading branch information
decryp2kanon authored Feb 16, 2020
1 parent cee8630 commit 8eb9635
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ bool static ProcessHeadersMessage(CNode *pfrom, CConnman *connman, const std::ve
}

// FIXME.SUGAR
// 120x bitcoin // disable additional download traffic during IBD
// 120x bitcoin // IBD: disable additional download during IBD, due to too much traffic
/*
if (nCount == MAX_HEADERS_RESULTS) {
// Headers message had its maximum size; the peer may have more headers.
Expand Down Expand Up @@ -3129,7 +3129,7 @@ void PeerLogicValidation::CheckForStaleTipAndEvictPeers(const Consensus::Params
// Check whether our tip is stale, and if so, allow using an extra
// outbound peer
if (TipMayBeStale(consensusParams)) {
if (!IsInitialBlockDownload()) { // FIXME.SUGAR // LOG_DISABLED during IBD
if (!IsInitialBlockDownload()) { // FIXME.SUGAR // IBD: do not print this connection log during IBD
LogPrintf("Potential stale tip detected, will try using extra outbound peer (last tip update: %d seconds ago)\n", time_in_seconds - g_last_tip_update);
}
connman->SetTryNewOutboundPeer(true);
Expand Down Expand Up @@ -3588,7 +3588,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic<bool>& interruptM
// Note: If all our peers are inbound, then we won't
// disconnect our sync peer for stalling; we have bigger
// problems if we can't get any outbound peers.
if (!pto->fWhitelisted) {
if (!pto->fWhitelisted && !IsInitialBlockDownload()) { // FIXME.SUGAR // IBD: do not disconnect *whitelisted* peers during IBD
LogPrintf("Timeout downloading headers from peer=%d, disconnecting\n", pto->GetId());
pto->fDisconnect = true;
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()

#include <validation.h> // FIXME.SUGAR // for IsInitialBlockDownload
#include <validation.h> // FIXME.SUGAR // IBD: for IsInitialBlockDownload()

#if !defined(HAVE_MSG_NOSIGNAL)
#define MSG_NOSIGNAL 0
Expand Down Expand Up @@ -515,7 +515,7 @@ bool ConnectSocketDirectly(const CService &addrConnect, const SOCKET& hSocket, i
}
if (nRet != 0)
{
if (!IsInitialBlockDownload()) { // FIXME.SUGAR // LOG_DISABLED during IBD
if (!IsInitialBlockDownload()) { // FIXME.SUGAR // IBD: do not print this connection log during IBD
LogPrintf("connect() to %s failed after select(): %s\n", addrConnect.ToString(), NetworkErrorString(nRet));
}
return false;
Expand All @@ -527,7 +527,7 @@ bool ConnectSocketDirectly(const CService &addrConnect, const SOCKET& hSocket, i
else
#endif
{
if (!IsInitialBlockDownload()) { // FIXME.SUGAR // LOG_DISABLED during IBD
if (!IsInitialBlockDownload()) { // FIXME.SUGAR // IBD: do not print this connection log during IBD
LogPrintf("connect() to %s failed: %s\n", addrConnect.ToString(), NetworkErrorString(WSAGetLastError()));
}
return false;
Expand Down

0 comments on commit 8eb9635

Please sign in to comment.