Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Update the time before which a proof is not allowed to have conflicting | * Update the time before which a proof is not allowed to have conflicting | ||||
* UTXO with this peer's proof. | * UTXO with this peer's proof. | ||||
*/ | */ | ||||
bool updateNextPossibleConflictTime(PeerId peerid, | bool updateNextPossibleConflictTime(PeerId peerid, | ||||
const std::chrono::seconds &nextTime); | const std::chrono::seconds &nextTime); | ||||
bool registerProof(const ProofRef &proof); | bool registerProof(const ProofRef &proof); | ||||
/** | |||||
* Rejection mode | |||||
* - DEFAULT: Default policy, reject a proof and attempt to keep it in the | |||||
* conflicting pool if possible. | |||||
* - INVALIDATE: Reject a proof by removing it from any of the pool. | |||||
* | |||||
* In any case if a peer is rejected, it attempts to pull the conflicting | |||||
* proofs back. | |||||
*/ | |||||
enum class RejectionMode { | |||||
DEFAULT, | |||||
INVALIDATE, | |||||
}; | |||||
bool rejectProof(const ProofId &proofid, | |||||
RejectionMode mode = RejectionMode::DEFAULT); | |||||
bool exists(const ProofId &proofid) const { | bool exists(const ProofId &proofid) const { | ||||
return getProof(proofid) != nullptr; | return getProof(proofid) != nullptr; | ||||
} | } | ||||
template <typename Callable> | template <typename Callable> | ||||
bool forPeer(const ProofId &proofid, Callable &&func) const { | bool forPeer(const ProofId &proofid, Callable &&func) const { | ||||
auto &pview = peers.get<by_proofid>(); | auto &pview = peers.get<by_proofid>(); | ||||
auto it = pview.find(proofid); | auto it = pview.find(proofid); | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |