Bitcoin ABC  0.24.7
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
avalanche::OrphanProofPool Class Reference

OrphanProofPool stores orphan proofs waiting for their UTXOs to be discovered. More...

#include <orphanproofpool.h>

Public Member Functions

 OrphanProofPool (size_t maxNumberOfStakes)
 
bool addProof (const ProofRef &proof)
 Add a proof to the pool. More...
 
bool removeProof (const ProofId &proofId)
 Remove a proof from the pool. More...
 
ProofRef getProof (const ProofId &proofId) const
 Get a pointer to a proof by id, or nullptr if the proof is not in the pool. More...
 
void rescan (PeerManager &peerManager)
 Rescan the pool to remove previously orphaned proofs that have become good or permanently bad. More...
 
size_t getNProofs () const
 
size_t getNStakes () const
 

Private Member Functions

void trimToMaximumSize ()
 Trim the proof pool to given max size. More...
 

Private Attributes

ProofContainer proofs
 
const size_t maxNumberOfStakes
 
size_t nStakes = 0
 

Detailed Description

OrphanProofPool stores orphan proofs waiting for their UTXOs to be discovered.

The pool has a size limit. When the pool is full, the oldest proof is removed when a new one is added.

Definition at line 46 of file orphanproofpool.h.

Constructor & Destructor Documentation

◆ OrphanProofPool()

avalanche::OrphanProofPool::OrphanProofPool ( size_t  maxNumberOfStakes)
inline

Definition at line 59 of file orphanproofpool.h.

Member Function Documentation

◆ addProof()

bool avalanche::OrphanProofPool::addProof ( const ProofRef proof)

Add a proof to the pool.

The caller is responsible for checking the proof.

Definition at line 22 of file orphanproofpool.cpp.

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

◆ getNProofs()

size_t avalanche::OrphanProofPool::getNProofs ( ) const

Definition at line 58 of file orphanproofpool.cpp.

◆ getNStakes()

size_t avalanche::OrphanProofPool::getNStakes ( ) const

Definition at line 62 of file orphanproofpool.cpp.

◆ getProof()

ProofRef avalanche::OrphanProofPool::getProof ( const ProofId proofId) const

Get a pointer to a proof by id, or nullptr if the proof is not in the pool.

Definition at line 43 of file orphanproofpool.cpp.

Here is the caller graph for this function:

◆ removeProof()

bool avalanche::OrphanProofPool::removeProof ( const ProofId proofId)

Remove a proof from the pool.

Definition at line 32 of file orphanproofpool.cpp.

◆ rescan()

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

Rescan the pool to remove previously orphaned proofs that have become good or permanently bad.

Definition at line 49 of file orphanproofpool.cpp.

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

◆ trimToMaximumSize()

void avalanche::OrphanProofPool::trimToMaximumSize ( )
private

Trim the proof pool to given max size.

It the current size is <= max size this has no effect.

Definition at line 13 of file orphanproofpool.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ maxNumberOfStakes

const size_t avalanche::OrphanProofPool::maxNumberOfStakes
private

Definition at line 49 of file orphanproofpool.h.

◆ nStakes

size_t avalanche::OrphanProofPool::nStakes = 0
private

Definition at line 50 of file orphanproofpool.h.

◆ proofs

ProofContainer avalanche::OrphanProofPool::proofs
private

Definition at line 47 of file orphanproofpool.h.


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