Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1,733 Lines • ▼ Show 20 Lines | if (!g_avalanche->isQuorumEstablished() || | ||||
.Make(NetMsgType::GETAVAADDR)); | .Make(NetMsgType::GETAVAADDR)); | ||||
PeerRef peer = GetPeerRef(avanodeId); | PeerRef peer = GetPeerRef(avanodeId); | ||||
WITH_LOCK(peer->m_addr_token_bucket_mutex, | WITH_LOCK(peer->m_addr_token_bucket_mutex, | ||||
peer->m_addr_token_bucket += GetMaxAddrToSend()); | peer->m_addr_token_bucket += GetMaxAddrToSend()); | ||||
return true; | return true; | ||||
}); | }); | ||||
} | } | ||||
if (m_chainman.ActiveChainstate().IsInitialBlockDownload()) { | |||||
// Don't request proofs while in IBD. We're likely to orphan them | |||||
// because we don't have the UTXOs. | |||||
goto scheduleLater; | |||||
} | |||||
// Send a getavaproofs to one of our peers | // Send a getavaproofs to one of our peers | ||||
m_connman.ForNode(avanode_outbound_ids.back(), [&](CNode *pavanode) { | m_connman.ForNode(avanode_outbound_ids.back(), [&](CNode *pavanode) { | ||||
LogPrint(BCLog::AVALANCHE, "Requesting compact proofs from peer %d\n", | LogPrint(BCLog::AVALANCHE, "Requesting compact proofs from peer %d\n", | ||||
pavanode->GetId()); | pavanode->GetId()); | ||||
m_connman.PushMessage(pavanode, | m_connman.PushMessage(pavanode, | ||||
CNetMsgMaker(pavanode->GetCommonVersion()) | CNetMsgMaker(pavanode->GetCommonVersion()) | ||||
.Make(NetMsgType::GETAVAPROOFS)); | .Make(NetMsgType::GETAVAPROOFS)); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 1,977 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::VERACK) { | ||||
// Send getavaaddr and getavaproofs to our avalanche outbound or | // Send getavaaddr and getavaproofs to our avalanche outbound or | ||||
// manual connections | // manual connections | ||||
if (isAvalancheOutboundOrManual(&pfrom)) { | if (isAvalancheOutboundOrManual(&pfrom)) { | ||||
m_connman.PushMessage(&pfrom, | m_connman.PushMessage(&pfrom, | ||||
msgMaker.Make(NetMsgType::GETAVAADDR)); | msgMaker.Make(NetMsgType::GETAVAADDR)); | ||||
WITH_LOCK(peer->m_addr_token_bucket_mutex, | WITH_LOCK(peer->m_addr_token_bucket_mutex, | ||||
peer->m_addr_token_bucket += GetMaxAddrToSend()); | peer->m_addr_token_bucket += GetMaxAddrToSend()); | ||||
if (pfrom.m_proof_relay) { | if (pfrom.m_proof_relay && | ||||
!m_chainman.ActiveChainstate().IsInitialBlockDownload()) { | |||||
m_connman.PushMessage( | m_connman.PushMessage( | ||||
&pfrom, msgMaker.Make(NetMsgType::GETAVAPROOFS)); | &pfrom, msgMaker.Make(NetMsgType::GETAVAPROOFS)); | ||||
pfrom.m_proof_relay->compactproofs_requested = true; | pfrom.m_proof_relay->compactproofs_requested = true; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
pfrom.fSuccessfullyConnected = true; | pfrom.fSuccessfullyConnected = true; | ||||
▲ Show 20 Lines • Show All 3,351 Lines • Show Last 20 Lines |