Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | bool PeerManager::rescorePeer(const PeerId peerid, uint32_t score) { | ||||
peers.modify(it, [this](Peer &p) { p.index = uint32_t(slots.size()); }); | peers.modify(it, [this](Peer &p) { p.index = uint32_t(slots.size()); }); | ||||
const uint64_t newStart = slotCount; | const uint64_t newStart = slotCount; | ||||
slots.emplace_back(newStart, score, peerid); | slots.emplace_back(newStart, score, peerid); | ||||
slotCount = newStart + score; | slotCount = newStart + score; | ||||
return true; | return true; | ||||
} | } | ||||
bool PeerManager::addNode(const Proof &proof, NodeId nodeid, | bool PeerManager::addNode(NodeId nodeid, const Proof &proof, | ||||
const CPubKey &pubkey) { | const CPubKey &pubkey) { | ||||
const PeerId peerid = getPeer(proof); | const PeerId peerid = getPeer(proof); | ||||
auto pit = peers.find(peerid); | auto pit = peers.find(peerid); | ||||
if (pit == peers.end()) { | if (pit == peers.end()) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines |