Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,186 Lines • ▼ Show 20 Lines | else if (strCommand == NetMsgType::INV) { | ||||
// mode if whitelistrelay is true | // mode if whitelistrelay is true | ||||
if (pfrom->fWhitelisted && | if (pfrom->fWhitelisted && | ||||
gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)) { | gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)) { | ||||
fBlocksOnly = false; | fBlocksOnly = false; | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
std::vector<CInv> vToFetch; | |||||
for (CInv &inv : vInv) { | for (CInv &inv : vInv) { | ||||
if (interruptMsgProc) { | if (interruptMsgProc) { | ||||
return true; | return true; | ||||
} | } | ||||
bool fAlreadyHave = AlreadyHave(inv); | bool fAlreadyHave = AlreadyHave(inv); | ||||
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), | LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), | ||||
fAlreadyHave ? "have" : "new", pfrom->GetId()); | fAlreadyHave ? "have" : "new", pfrom->GetId()); | ||||
Show All 29 Lines | else if (strCommand == NetMsgType::INV) { | ||||
!IsInitialBlockDownload()) { | !IsInitialBlockDownload()) { | ||||
pfrom->AskFor(inv); | pfrom->AskFor(inv); | ||||
} | } | ||||
} | } | ||||
// Track requests for our stuff | // Track requests for our stuff | ||||
GetMainSignals().Inventory(inv.hash); | GetMainSignals().Inventory(inv.hash); | ||||
} | } | ||||
if (!vToFetch.empty()) { | |||||
connman->PushMessage(pfrom, | |||||
msgMaker.Make(NetMsgType::GETDATA, vToFetch)); | |||||
} | |||||
} | } | ||||
else if (strCommand == NetMsgType::GETDATA) { | else if (strCommand == NetMsgType::GETDATA) { | ||||
std::vector<CInv> vInv; | std::vector<CInv> vInv; | ||||
vRecv >> vInv; | vRecv >> vInv; | ||||
if (vInv.size() > MAX_INV_SZ) { | if (vInv.size() > MAX_INV_SZ) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Misbehaving(pfrom, 20, "too-many-inv"); | Misbehaving(pfrom, 20, "too-many-inv"); | ||||
▲ Show 20 Lines • Show All 2,111 Lines • Show Last 20 Lines |