Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,852 Lines • ▼ Show 20 Lines | static void ProcessGetBlockData(const Config &config, CNode &pfrom, | ||||
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion()); | const CNetMsgMaker msgMaker(pfrom.GetCommonVersion()); | ||||
// Disconnect node in case we have reached the outbound limit for serving | // Disconnect node in case we have reached the outbound limit for serving | ||||
// historical blocks. | // historical blocks. | ||||
if (send && connman.OutboundTargetReached(true) && | if (send && connman.OutboundTargetReached(true) && | ||||
(((pindexBestHeader != nullptr) && | (((pindexBestHeader != nullptr) && | ||||
(pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() > | (pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() > | ||||
HISTORICAL_BLOCK_AGE)) || | HISTORICAL_BLOCK_AGE)) || | ||||
inv.type == MSG_FILTERED_BLOCK) && | inv.type == MSG_FILTERED_BLOCK) && | ||||
/* never disconnect nodes with the noban permission */ | // nodes with the download permission may exceed target | ||||
!pfrom.HasPermission(PF_NOBAN)) { | !pfrom.HasPermission(PF_DOWNLOAD)) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"historical block serving limit reached, disconnect peer=%d\n", | "historical block serving limit reached, disconnect peer=%d\n", | ||||
pfrom.GetId()); | pfrom.GetId()); | ||||
// disconnect node | // disconnect node | ||||
pfrom.fDisconnect = true; | pfrom.fDisconnect = true; | ||||
send = false; | send = false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,410 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::GETHEADERS) { | ||||
"getheaders locator size %lld > %d, disconnect peer=%d\n", | "getheaders locator size %lld > %d, disconnect peer=%d\n", | ||||
locator.vHave.size(), MAX_LOCATOR_SZ, pfrom.GetId()); | locator.vHave.size(), MAX_LOCATOR_SZ, pfrom.GetId()); | ||||
pfrom.fDisconnect = true; | pfrom.fDisconnect = true; | ||||
return; | return; | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (::ChainstateActive().IsInitialBlockDownload() && | if (::ChainstateActive().IsInitialBlockDownload() && | ||||
!pfrom.HasPermission(PF_NOBAN)) { | !pfrom.HasPermission(PF_DOWNLOAD)) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"Ignoring getheaders from peer=%d because node is in " | "Ignoring getheaders from peer=%d because node is in " | ||||
"initial block download\n", | "initial block download\n", | ||||
pfrom.GetId()); | pfrom.GetId()); | ||||
return; | return; | ||||
} | } | ||||
CNodeState *nodestate = State(pfrom.GetId()); | CNodeState *nodestate = State(pfrom.GetId()); | ||||
▲ Show 20 Lines • Show All 2,268 Lines • Show Last 20 Lines |