Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
avalanche::ProofPool Class Reference

Map a proof to each utxo. More...

#include <proofpool.h>

Public Types

enum  AddProofStatus { REJECTED = 0 , SUCCEED = 1 , DUPLICATED = 2 }
 
using ConflictingProofSet = std::set< ProofRef, ConflictingProofComparator >
 

Public Member Functions

AddProofStatus addProofIfNoConflict (const ProofRef &proof, ConflictingProofSet &conflictingProofs)
 Attempt to add a proof to the pool, and fail if there is a conflict on any UTXO.
 
AddProofStatus addProofIfNoConflict (const ProofRef &proof)
 
AddProofStatus addProofIfPreferred (const ProofRef &proof, ConflictingProofSet &conflictingProofs)
 Attempt to add a proof to the pool.
 
AddProofStatus addProofIfPreferred (const ProofRef &proof)
 
bool removeProof (ProofId proofid)
 
std::unordered_set< ProofRef, SaltedProofHasherrescan (PeerManager &peerManager)
 
template<typename Callable >
void forEachProof (Callable &&func) const
 
ProofIdSet getProofIds () const
 
ProofRef getProof (const ProofId &proofid) const
 
ProofRef getProof (const COutPoint &outpoint) const
 
ProofRef getLowestScoreProof () const
 
size_t size () const
 
size_t countProofs () const
 

Private Attributes

boost::multi_index_container< ProofPoolEntry, bmi::indexed_by< bmi::hashed_unique< bmi::tag< by_utxo >, bmi::const_mem_fun< ProofPoolEntry, const COutPoint &, &ProofPoolEntry::getUTXO >, SaltedOutpointHasher >, bmi::hashed_non_unique< bmi::tag< by_proofid >, ProofPoolEntryProofIdKeyExtractor, SaltedProofIdHasher >, bmi::ordered_non_unique< bmi::tag< by_proof_score >, bmi::member< ProofPoolEntry, ProofRef, &ProofPoolEntry::proof >, ProofComparatorByScore > > > pool
 
bool cacheClean = true
 
size_t cacheProofCount = 0
 

Detailed Description

Map a proof to each utxo.

A proof can be mapped with several utxos.

Definition at line 57 of file proofpool.h.

Member Typedef Documentation

◆ ConflictingProofSet

Definition at line 88 of file proofpool.h.

Member Enumeration Documentation

◆ AddProofStatus

Enumerator
REJECTED 

Rejected due to conflicts.

SUCCEED 

Added successfully.

DUPLICATED 

Already in pool.

Definition at line 82 of file proofpool.h.

Member Function Documentation

◆ addProofIfNoConflict() [1/2]

AddProofStatus avalanche::ProofPool::addProofIfNoConflict ( const ProofRef proof)
inline

Definition at line 96 of file proofpool.h.

Here is the call graph for this function:

◆ addProofIfNoConflict() [2/2]

ProofPool::AddProofStatus avalanche::ProofPool::addProofIfNoConflict ( const ProofRef proof,
ConflictingProofSet conflictingProofs 
)

Attempt to add a proof to the pool, and fail if there is a conflict on any UTXO.

Definition at line 13 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addProofIfPreferred() [1/2]

AddProofStatus avalanche::ProofPool::addProofIfPreferred ( const ProofRef proof)
inline

Definition at line 108 of file proofpool.h.

Here is the call graph for this function:

◆ addProofIfPreferred() [2/2]

ProofPool::AddProofStatus avalanche::ProofPool::addProofIfPreferred ( const ProofRef proof,
ConflictingProofSet conflictingProofs 
)

Attempt to add a proof to the pool.

In case there is a conflict with one or more UTXO, the proof is only added if it is the best candidate over all the conflicting proofs according to ConflictingProofComparator.

Definition at line 54 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ countProofs()

size_t avalanche::ProofPool::countProofs ( ) const

Definition at line 129 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forEachProof()

template<typename Callable >
void avalanche::ProofPool::forEachProof ( Callable &&  func) const
inline

Definition at line 118 of file proofpool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLowestScoreProof()

ProofRef avalanche::ProofPool::getLowestScoreProof ( ) const

Definition at line 123 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProof() [1/2]

ProofRef avalanche::ProofPool::getProof ( const COutPoint outpoint) const

Definition at line 118 of file proofpool.cpp.

◆ getProof() [2/2]

ProofRef avalanche::ProofPool::getProof ( const ProofId proofid) const

Definition at line 112 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProofIds()

ProofIdSet avalanche::ProofPool::getProofIds ( ) const

Definition at line 101 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeProof()

bool avalanche::ProofPool::removeProof ( ProofId  proofid)

Definition at line 79 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rescan()

std::unordered_set< ProofRef, SaltedProofHasher > avalanche::ProofPool::rescan ( PeerManager peerManager)

Definition at line 86 of file proofpool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

size_t avalanche::ProofPool::size ( ) const
inline

Definition at line 135 of file proofpool.h.

Here is the caller graph for this function:

Member Data Documentation

◆ cacheClean

bool avalanche::ProofPool::cacheClean = true
mutableprivate

Definition at line 78 of file proofpool.h.

◆ cacheProofCount

size_t avalanche::ProofPool::cacheProofCount = 0
mutableprivate

Definition at line 79 of file proofpool.h.

◆ pool

boost::multi_index_container< ProofPoolEntry, bmi::indexed_by< bmi::hashed_unique< bmi::tag<by_utxo>, bmi::const_mem_fun<ProofPoolEntry, const COutPoint &, &ProofPoolEntry::getUTXO>, SaltedOutpointHasher>, bmi::hashed_non_unique<bmi::tag<by_proofid>, ProofPoolEntryProofIdKeyExtractor, SaltedProofIdHasher>, bmi::ordered_non_unique< bmi::tag<by_proof_score>, bmi::member<ProofPoolEntry, ProofRef, &ProofPoolEntry::proof>, ProofComparatorByScore> > > avalanche::ProofPool::pool
private

Definition at line 76 of file proofpool.h.


The documentation for this class was generated from the following files: