Anoncoin  0.9.4
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CBloomFilter Class Reference

BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transactions we sends them. More...

#include <bloom.h>

Public Member Functions

 CBloomFilter (unsigned int nElements, double nFPRate, unsigned int nTweak, unsigned char nFlagsIn)
 
 CBloomFilter ()
 
void insert (const uint256 &hash)
 
bool contains (const std::vector< unsigned char > &vKey) const
 
bool contains (const COutPoint &outpoint) const
 
bool contains (const uint256 &hash) const
 
bool IsWithinSizeConstraints () const
 
bool IsRelevantAndUpdate (const CTransaction &tx, const uint256 &hash)
 
void UpdateEmptyFull ()
 

Private Member Functions

unsigned int Hash (unsigned int nHashNum, const std::vector< unsigned char > &vDataToHash) const
 

Private Attributes

std::vector< unsigned char > vData
 
bool isFull
 
bool isEmpty
 
unsigned int nHashFuncs
 
unsigned int nTweak
 
unsigned char nFlags
 

Detailed Description

BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transactions we sends them.

This allows for significantly more efficient transaction and block downloads.

Because bloom filters are probabilistic, an SPV node can increase the false- positive rate, making us send them transactions which aren't actually theirs, allowing clients to trade more bandwidth for more privacy by obfuscating which keys are owned by them.

Definition at line 43 of file bloom.h.

Constructor & Destructor Documentation

CBloomFilter::CBloomFilter ( unsigned int  nElements,
double  nFPRate,
unsigned int  nTweak,
unsigned char  nFlagsIn 
)

Definition at line 19 of file bloom.cpp.

CBloomFilter::CBloomFilter ( )
inline

Definition at line 64 of file bloom.h.

Member Function Documentation

bool CBloomFilter::contains ( const std::vector< unsigned char > &  vKey) const

Definition at line 68 of file bloom.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBloomFilter::contains ( const COutPoint outpoint) const

Definition at line 84 of file bloom.cpp.

Here is the call graph for this function:

bool CBloomFilter::contains ( const uint256 hash) const

Definition at line 92 of file bloom.cpp.

Here is the call graph for this function:

unsigned int CBloomFilter::Hash ( unsigned int  nHashNum,
const std::vector< unsigned char > &  vDataToHash 
) const
inlineprivate

Definition at line 35 of file bloom.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBloomFilter::insert ( const uint256 hash)

Definition at line 41 of file bloom.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBloomFilter::IsRelevantAndUpdate ( const CTransaction tx,
const uint256 hash 
)

Definition at line 103 of file bloom.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBloomFilter::IsWithinSizeConstraints ( ) const

Definition at line 98 of file bloom.cpp.

void CBloomFilter::UpdateEmptyFull ( )

Definition at line 172 of file bloom.cpp.

Member Data Documentation

bool CBloomFilter::isEmpty
private

Definition at line 48 of file bloom.h.

bool CBloomFilter::isFull
private

Definition at line 47 of file bloom.h.

unsigned char CBloomFilter::nFlags
private

Definition at line 51 of file bloom.h.

unsigned int CBloomFilter::nHashFuncs
private

Definition at line 49 of file bloom.h.

unsigned int CBloomFilter::nTweak
private

Definition at line 50 of file bloom.h.

std::vector<unsigned char> CBloomFilter::vData
private

Definition at line 46 of file bloom.h.


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