Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 3,939 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::BLOCK) { | ||||
pfrom.nLastBlockTime = GetTime(); | pfrom.nLastBlockTime = GetTime(); | ||||
} else { | } else { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
mapBlockSource.erase(hash); | mapBlockSource.erase(hash); | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
std::vector<std::string> avamessages{ | |||||
NetMsgType::AVAHELLO, NetMsgType::AVAPOLL, NetMsgType::AVARESPONSE}; | |||||
// Discourage avalanche messages if we don't participate in the network. | |||||
if (std::find(avamessages.begin(), avamessages.end(), msg_type) != | |||||
avamessages.end() && | |||||
!gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | |||||
Misbehaving(pfrom, 20, "unsolicited-ava-message"); | |||||
} | |||||
if (msg_type == NetMsgType::AVAHELLO && g_avalanche && | if (msg_type == NetMsgType::AVAHELLO && g_avalanche && | ||||
gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | ||||
if (!pfrom.m_avalanche_state) { | if (!pfrom.m_avalanche_state) { | ||||
pfrom.m_avalanche_state = std::make_unique<CNode::AvalancheState>(); | pfrom.m_avalanche_state = std::make_unique<CNode::AvalancheState>(); | ||||
} | } | ||||
CHashVerifier<CDataStream> verifier(&vRecv); | CHashVerifier<CDataStream> verifier(&vRecv); | ||||
avalanche::Delegation &delegation = pfrom.m_avalanche_state->delegation; | avalanche::Delegation &delegation = pfrom.m_avalanche_state->delegation; | ||||
▲ Show 20 Lines • Show All 1,601 Lines • Show Last 20 Lines |