Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,972 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::VERACK) { | ||||
bool fAnnounceUsingCMPCTBLOCK = false; | bool fAnnounceUsingCMPCTBLOCK = false; | ||||
uint64_t nCMPCTBLOCKVersion = 1; | uint64_t nCMPCTBLOCKVersion = 1; | ||||
m_connman.PushMessage(&pfrom, | m_connman.PushMessage(&pfrom, | ||||
msgMaker.Make(NetMsgType::SENDCMPCT, | msgMaker.Make(NetMsgType::SENDCMPCT, | ||||
fAnnounceUsingCMPCTBLOCK, | fAnnounceUsingCMPCTBLOCK, | ||||
nCMPCTBLOCKVersion)); | nCMPCTBLOCKVersion)); | ||||
} | } | ||||
if ((pfrom.nServices & NODE_AVALANCHE) && g_avalanche && | if (g_avalanche && | ||||
gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | ||||
if (g_avalanche->sendHello(&pfrom)) { | for (const avalanche::Peer &peer : g_avalanche->getPeers()) { | ||||
pfrom.PushProofInventory(peer.proof.getId()); | |||||
} | |||||
if ((pfrom.nServices & NODE_AVALANCHE) && | |||||
g_avalanche->sendHello(&pfrom)) { | |||||
LogPrint(BCLog::NET, "Send avahello to peer %d\n", | LogPrint(BCLog::NET, "Send avahello to peer %d\n", | ||||
pfrom.GetId()); | pfrom.GetId()); | ||||
} | } | ||||
} | } | ||||
pfrom.fSuccessfullyConnected = true; | pfrom.fSuccessfullyConnected = true; | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,369 Lines • ▼ Show 20 Lines | if (pingSend) { | ||||
m_connman.PushMessage( | m_connman.PushMessage( | ||||
pto, msgMaker.Make(NetMsgType::INV, vInv)); | pto, msgMaker.Make(NetMsgType::INV, vInv)); | ||||
vInv.clear(); | vInv.clear(); | ||||
} | } | ||||
pto->m_tx_relay->filterInventoryKnown.insert(txid); | pto->m_tx_relay->filterInventoryKnown.insert(txid); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Add proofs to inventory | |||||
if (pto->m_proof_relay != nullptr) { | |||||
auto it = pto->m_proof_relay->setInventoryProofToSend.begin(); | |||||
while (it != | |||||
pto->m_proof_relay->setInventoryProofToSend.end()) { | |||||
vInv.push_back(CInv(MSG_AVA_PROOF, *it)); | |||||
if (vInv.size() == MAX_INV_SZ) { | |||||
m_connman.PushMessage( | |||||
pto, msgMaker.Make(NetMsgType::INV, vInv)); | |||||
vInv.clear(); | |||||
} | |||||
it = pto->m_proof_relay->setInventoryProofToSend.erase(it); | |||||
} | } | ||||
} | |||||
} | |||||
if (!vInv.empty()) { | if (!vInv.empty()) { | ||||
m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv)); | m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv)); | ||||
} | } | ||||
// Detect whether we're stalling | // Detect whether we're stalling | ||||
current_time = GetTime<std::chrono::microseconds>(); | current_time = GetTime<std::chrono::microseconds>(); | ||||
// nNow is the current system time (GetTimeMicros is not mockable) and | // nNow is the current system time (GetTimeMicros is not mockable) and | ||||
// should be replaced by the mockable current_time eventually | // should be replaced by the mockable current_time eventually | ||||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |