Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proofpool.h
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | boost::multi_index_container< | ||||
SaltedProofIdHasher>, | SaltedProofIdHasher>, | ||||
// index by proof score | // index by proof score | ||||
bmi::ordered_non_unique< | bmi::ordered_non_unique< | ||||
bmi::tag<by_proof_score>, | bmi::tag<by_proof_score>, | ||||
bmi::member<ProofPoolEntry, ProofRef, &ProofPoolEntry::proof>, | bmi::member<ProofPoolEntry, ProofRef, &ProofPoolEntry::proof>, | ||||
ProofComparatorByScore>>> | ProofComparatorByScore>>> | ||||
pool; | pool; | ||||
bool cacheClean = true; | |||||
size_t cacheProofCount = 0; | |||||
struct ProofRegistrationTime { | struct ProofRegistrationTime { | ||||
ProofId proofid; | ProofId proofid; | ||||
// std::chrono::duration is not hashable by default, so use an integer | // std::chrono::duration is not hashable by default, so use an integer | ||||
int64_t registrationTime; | int64_t registrationTime; | ||||
ProofRegistrationTime(const ProofId &proofidIn, | ProofRegistrationTime(const ProofId &proofidIn, | ||||
int64_t registrationTimeIn) | int64_t registrationTimeIn) | ||||
: proofid(proofidIn), registrationTime(registrationTimeIn) {} | : proofid(proofidIn), registrationTime(registrationTimeIn) {} | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | public: | ||||
ProofRef getProof(const ProofId &proofid) const; | ProofRef getProof(const ProofId &proofid) const; | ||||
ProofRef getProof(const COutPoint &outpoint) const; | ProofRef getProof(const COutPoint &outpoint) const; | ||||
ProofRef getLowestScoreProof() const; | ProofRef getLowestScoreProof() const; | ||||
std::optional<int64_t> getRegistrationTime(const ProofId &proofid) const; | std::optional<int64_t> getRegistrationTime(const ProofId &proofid) const; | ||||
size_t size() const { return pool.size(); } | size_t size() const { return pool.size(); } | ||||
size_t countProofs(); | size_t countProofs() { return registrationTimes.size(); }; | ||||
}; | }; | ||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_PROOFPOOL_H | #endif // BITCOIN_AVALANCHE_PROOFPOOL_H |