Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | bool PeerManager::updateNextRequestTime(NodeId nodeid, TimePoint timeout) { | ||||
auto it = nodes.find(nodeid); | auto it = nodes.find(nodeid); | ||||
if (it == nodes.end()) { | if (it == nodes.end()) { | ||||
return false; | return false; | ||||
} | } | ||||
return nodes.modify(it, [&](Node &n) { n.nextRequestTime = timeout; }); | return nodes.modify(it, [&](Node &n) { n.nextRequestTime = timeout; }); | ||||
} | } | ||||
bool PeerManager::latchAvaproofsSent(NodeId nodeid) { | |||||
auto it = nodes.find(nodeid); | |||||
if (it == nodes.end()) { | |||||
return false; | |||||
} | |||||
return !it->avaproofsSent && | |||||
nodes.modify(it, [&](Node &n) { n.avaproofsSent = true; }); | |||||
} | |||||
static bool isOrphanState(const ProofValidationState &state) { | static bool isOrphanState(const ProofValidationState &state) { | ||||
return state.GetResult() == ProofValidationResult::MISSING_UTXO || | return state.GetResult() == ProofValidationResult::MISSING_UTXO || | ||||
state.GetResult() == ProofValidationResult::HEIGHT_MISMATCH; | state.GetResult() == ProofValidationResult::HEIGHT_MISMATCH; | ||||
} | } | ||||
bool PeerManager::updateNextPossibleConflictTime( | bool PeerManager::updateNextPossibleConflictTime( | ||||
PeerId peerid, const std::chrono::seconds &nextTime) { | PeerId peerid, const std::chrono::seconds &nextTime) { | ||||
auto it = peers.find(peerid); | auto it = peers.find(peerid); | ||||
▲ Show 20 Lines • Show All 614 Lines • Show Last 20 Lines |