Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 493 Lines • ▼ Show 20 Lines | CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) | ||||
: CAddress(CService(), addr.nServices)); | : CAddress(CService(), addr.nServices)); | ||||
CAddress addrMe = CAddress(CService(), nLocalNodeServices); | CAddress addrMe = CAddress(CService(), nLocalNodeServices); | ||||
connman->PushMessage(pnode, | connman->PushMessage(pnode, | ||||
CNetMsgMaker(INIT_PROTO_VERSION) | CNetMsgMaker(INIT_PROTO_VERSION) | ||||
.Make(NetMsgType::VERSION, PROTOCOL_VERSION, | .Make(NetMsgType::VERSION, PROTOCOL_VERSION, | ||||
uint64_t(nLocalNodeServices), nTime, addrYou, | uint64_t(nLocalNodeServices), nTime, addrYou, | ||||
addrMe, nonce, userAgent(config), | addrMe, nonce, userAgent(config), | ||||
nNodeStartingHeight, ::fRelayTxes)); | nNodeStartingHeight, ::g_relay_txes)); | ||||
if (fLogIPs) { | if (fLogIPs) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"send version message: version %d, blocks=%d, us=%s, them=%s, " | "send version message: version %d, blocks=%d, us=%s, them=%s, " | ||||
"peer=%d\n", | "peer=%d\n", | ||||
PROTOCOL_VERSION, nNodeStartingHeight, addrMe.ToString(), | PROTOCOL_VERSION, nNodeStartingHeight, addrMe.ToString(), | ||||
addrYou.ToString(), nodeid); | addrYou.ToString(), nodeid); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 2,031 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::INV) { | ||||
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, "oversized-inv"); | Misbehaving(pfrom, 20, "oversized-inv"); | ||||
return error("message inv size() = %u", vInv.size()); | return error("message inv size() = %u", vInv.size()); | ||||
} | } | ||||
bool fBlocksOnly = !fRelayTxes; | bool fBlocksOnly = !g_relay_txes; | ||||
// Allow whitelisted peers to send data other than blocks in blocks only | // Allow whitelisted peers to send data other than blocks in blocks only | ||||
// mode if whitelistrelay is true | // mode if whitelistrelay is true | ||||
if (pfrom->HasPermission(PF_RELAY)) { | if (pfrom->HasPermission(PF_RELAY)) { | ||||
fBlocksOnly = false; | fBlocksOnly = false; | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::GETHEADERS) { | ||||
msgMaker.Make(NetMsgType::HEADERS, vHeaders)); | msgMaker.Make(NetMsgType::HEADERS, vHeaders)); | ||||
return true; | return true; | ||||
} | } | ||||
if (strCommand == NetMsgType::TX) { | if (strCommand == NetMsgType::TX) { | ||||
// Stop processing the transaction early if | // Stop processing the transaction early if | ||||
// We are in blocks only mode and peer is either not whitelisted or | // We are in blocks only mode and peer is either not whitelisted or | ||||
// whitelistrelay is off | // whitelistrelay is off | ||||
if (!fRelayTxes && !pfrom->HasPermission(PF_RELAY)) { | if (!g_relay_txes && !pfrom->HasPermission(PF_RELAY)) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"transaction sent in violation of protocol peer=%d\n", | "transaction sent in violation of protocol peer=%d\n", | ||||
pfrom->GetId()); | pfrom->GetId()); | ||||
return true; | return true; | ||||
} | } | ||||
CTransactionRef ptx; | CTransactionRef ptx; | ||||
vRecv >> ptx; | vRecv >> ptx; | ||||
▲ Show 20 Lines • Show All 2,044 Lines • Show Last 20 Lines |