Bitcoin ABC  0.24.10
P2P Digital Currency
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. More...
 
AddProofStatus addProofIfNoConflict (const ProofRef &proof)
 
AddProofStatus addProofIfPreferred (const ProofRef &proof, ConflictingProofSet &conflictingProofs)
 Attempt to add a proof to the pool. More...
 
AddProofStatus addProofIfPreferred (const ProofRef &proof)
 
bool removeProof (ProofId proofid)
 
void rescan (PeerManager &peerManager)
 
ProofRef getProof (const ProofId &proofid) const
 
ProofRef getProof (const COutPoint &outpoint) const
 
size_t size () 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 > > > pool
 

Detailed Description

Map a proof to each utxo.

A proof can be mapped with several utxos.

Definition at line 51 of file proofpool.h.

Member Typedef Documentation

◆ ConflictingProofSet

Definition at line 74 of file proofpool.h.

Member Enumeration Documentation

◆ AddProofStatus

Enumerator
REJECTED 

Rejected due to conflicts.

SUCCEED 

Added successfully.

DUPLICATED 

Already in pool.

Definition at line 68 of file proofpool.h.

Member Function Documentation

◆ addProofIfNoConflict() [1/2]

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

Definition at line 82 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 caller graph for this function:

◆ addProofIfPreferred() [1/2]

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

Definition at line 94 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 53 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 97 of file proofpool.cpp.

◆ getProof() [2/2]

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

Definition at line 91 of file proofpool.cpp.

Here is the caller graph for this function:

◆ removeProof()

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

Definition at line 77 of file proofpool.cpp.

Here is the caller graph for this function:

◆ rescan()

void avalanche::ProofPool::rescan ( PeerManager peerManager)

Definition at line 82 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 106 of file proofpool.h.

Here is the caller graph for this function:

Member Data Documentation

◆ 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> > > avalanche::ProofPool::pool
private

Definition at line 65 of file proofpool.h.


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