Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | std::map<CBlockIndex *, AvalancheVote> responseIndex; | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool AvalancheProcessor::addPeer(NodeId nodeid, int64_t score, CPubKey pubkey) { | bool AvalancheProcessor::addPeer(NodeId nodeid, int64_t score, CPubKey pubkey) { | ||||
return peerSet.getWriteView() | return peerSet.getWriteView() | ||||
->insert({nodeid, score, std::chrono::steady_clock::now(), | ->insert({nodeid, /* peerid is unused here */ 0, std::move(pubkey)}) | ||||
std::move(pubkey)}) | |||||
.second; | .second; | ||||
} | } | ||||
bool AvalancheProcessor::forNode( | bool AvalancheProcessor::forNode( | ||||
NodeId nodeid, std::function<bool(const AvalancheNode &n)> func) const { | NodeId nodeid, std::function<bool(const AvalancheNode &n)> func) const { | ||||
auto r = peerSet.getReadView(); | auto r = peerSet.getReadView(); | ||||
auto it = r->find(nodeid); | auto it = r->find(nodeid); | ||||
return it != r->end() && func(*it); | return it != r->end() && func(*it); | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |