Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 433 Lines • ▼ Show 20 Lines | for (const Peer &peer : peers) { | ||||
newlyDanglingProofIds.push_back(peer.getProofId()); | newlyDanglingProofIds.push_back(peer.getProofId()); | ||||
} | } | ||||
} | } | ||||
for (const ProofId &proofid : newlyDanglingProofIds) { | for (const ProofId &proofid : newlyDanglingProofIds) { | ||||
rejectProof(proofid, RejectionMode::INVALIDATE); | rejectProof(proofid, RejectionMode::INVALIDATE); | ||||
danglingProofIds.insert(proofid); | danglingProofIds.insert(proofid); | ||||
} | } | ||||
// If we have dangling proof, this is a good indicator that we need to | |||||
// request more nodes from our peers. | |||||
needMoreNodes = !newlyDanglingProofIds.empty(); | |||||
} | } | ||||
NodeId PeerManager::selectNode() { | NodeId PeerManager::selectNode() { | ||||
for (int retry = 0; retry < SELECT_NODE_MAX_RETRY; retry++) { | for (int retry = 0; retry < SELECT_NODE_MAX_RETRY; retry++) { | ||||
const PeerId p = selectPeer(); | const PeerId p = selectPeer(); | ||||
// If we cannot find a peer, it may be due to the fact that it is | // If we cannot find a peer, it may be due to the fact that it is | ||||
// unlikely due to high fragmentation, so compact and retry. | // unlikely due to high fragmentation, so compact and retry. | ||||
▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines |