Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,356 Lines • ▼ Show 20 Lines | static void ProcessGetBlockData(const Config &config, CNode *pfrom, | ||||
// Never disconnect whitelisted nodes. | // Never disconnect whitelisted nodes. | ||||
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) && | ||||
!pfrom->fWhitelisted) { | !pfrom->fWhitelisted) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"historical block serving limit reached, " | "historical block serving limit reached, disconnect peer=%d\n", | ||||
"disconnect peer=%d\n", | |||||
pfrom->GetId()); | pfrom->GetId()); | ||||
// disconnect node | // disconnect node | ||||
pfrom->fDisconnect = true; | pfrom->fDisconnect = true; | ||||
send = false; | send = false; | ||||
} | } | ||||
// Avoid leaking prune-height by never sending blocks below the | // Avoid leaking prune-height by never sending blocks below the | ||||
// NODE_NETWORK_LIMITED threshold. | // NODE_NETWORK_LIMITED threshold. | ||||
▲ Show 20 Lines • Show All 701 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::VERSION) { | ||||
int64_t nTimeOffset = nTime - GetTime(); | int64_t nTimeOffset = nTime - GetTime(); | ||||
pfrom->nTimeOffset = nTimeOffset; | pfrom->nTimeOffset = nTimeOffset; | ||||
AddTimeData(pfrom->addr, nTimeOffset); | AddTimeData(pfrom->addr, nTimeOffset); | ||||
// If the peer is old enough to have the old alert system, send it the | // If the peer is old enough to have the old alert system, send it the | ||||
// final alert. | // final alert. | ||||
if (pfrom->nVersion <= 70012) { | if (pfrom->nVersion <= 70012) { | ||||
CDataStream finalAlert( | CDataStream finalAlert( | ||||
ParseHex("60010000000000000000000000ffffff7f00000000ffffff7ffef" | ParseHex( | ||||
"fff7f01ffffff7f00000000ffffff7f00ffffff7f002f55524745" | "60010000000000000000000000ffffff7f00000000ffffff7ffeffff7f" | ||||
"4e543a20416c657274206b657920636f6d70726f6d697365642c2" | "01ffffff7f00000000ffffff7f00ffffff7f002f555247454e543a2041" | ||||
"075706772616465207265717569726564004630440220653febd6" | "6c657274206b657920636f6d70726f6d697365642c2075706772616465" | ||||
"410f470f6bae11cad19c48413becb1ac2c17f908fd0fd53bdc3ab" | "207265717569726564004630440220653febd6410f470f6bae11cad19c" | ||||
"d5202206d0e9c96fe88d4a0f01ed9dedae2b6f9e00da94cad0fec" | "48413becb1ac2c17f908fd0fd53bdc3abd5202206d0e9c96fe88d4a0f0" | ||||
"aae66ecf689bf71b50"), | "1ed9dedae2b6f9e00da94cad0fecaae66ecf689bf71b50"), | ||||
SER_NETWORK, PROTOCOL_VERSION); | SER_NETWORK, PROTOCOL_VERSION); | ||||
connman->PushMessage( | connman->PushMessage( | ||||
pfrom, CNetMsgMaker(nSendVersion).Make("alert", finalAlert)); | pfrom, CNetMsgMaker(nSendVersion).Make("alert", finalAlert)); | ||||
} | } | ||||
// Feeler connections exist only to verify if address is online. | // Feeler connections exist only to verify if address is online. | ||||
if (pfrom->fFeeler) { | if (pfrom->fFeeler) { | ||||
assert(pfrom->fInbound == false); | assert(pfrom->fInbound == false); | ||||
▲ Show 20 Lines • Show All 2,291 Lines • ▼ Show 20 Lines | if (!pto->fClient && | ||||
if (State(staller)->nStallingSince == 0) { | if (State(staller)->nStallingSince == 0) { | ||||
State(staller)->nStallingSince = nNow; | State(staller)->nStallingSince = nNow; | ||||
LogPrint(BCLog::NET, "Stall started peer=%d\n", staller); | LogPrint(BCLog::NET, "Stall started peer=%d\n", staller); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// | // | ||||
// Message: getdata (non-blocks) | // Message: getdata (transactions) | ||||
// | // | ||||
while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) { | while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) { | ||||
const CInv &inv = (*pto->mapAskFor.begin()).second; | const CInv &inv = (*pto->mapAskFor.begin()).second; | ||||
if (!AlreadyHave(inv)) { | if (!AlreadyHave(inv)) { | ||||
LogPrint(BCLog::NET, "Requesting %s peer=%d\n", inv.ToString(), | LogPrint(BCLog::NET, "Requesting %s peer=%d\n", inv.ToString(), | ||||
pto->GetId()); | pto->GetId()); | ||||
vGetData.push_back(inv); | vGetData.push_back(inv); | ||||
if (vGetData.size() >= 1000) { | if (vGetData.size() >= 1000) { | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |