5 #ifndef FABCOIN_BLOOM_H 6 #define FABCOIN_BLOOM_H 17 static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000;
18 static const unsigned int MAX_HASH_FUNCS = 50;
47 std::vector<unsigned char>
vData;
54 unsigned int Hash(
unsigned int nHashNum,
const std::vector<unsigned char>& vDataToHash)
const;
57 CBloomFilter(
const unsigned int nElements,
const double nFPRate,
const unsigned int nTweak);
70 CBloomFilter(
const unsigned int nElements,
const double nFPRate,
const unsigned int nTweak,
unsigned char nFlagsIn);
71 CBloomFilter() : isFull(true), isEmpty(false), nHashFuncs(0), nTweak(0), nFlags(0) {}
75 template <
typename Stream,
typename Operation>
83 void insert(
const std::vector<unsigned char>& vKey);
87 bool contains(
const std::vector<unsigned char>& vKey)
const;
92 void reset(
const unsigned int nNewTweak);
127 void insert(
const std::vector<unsigned char>& vKey);
129 bool contains(
const std::vector<unsigned char>& vKey)
const;
143 #endif // FABCOIN_BLOOM_H bloomflags
First two bits of nFlags control how much IsRelevantAndUpdate actually updates The remaining bits are...
bool IsRelevantAndUpdate(const CTransaction &tx)
Also adds any outputs which match the filter to the filter (to match their spending txes) ...
BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transaction...
unsigned int Hash(unsigned int nHashNum, const std::vector< unsigned char > &vDataToHash) const
RollingBloomFilter is a probabilistic "keep track of most recently inserted" set. ...
std::vector< unsigned char > vData
void reset(const unsigned int nNewTweak)
void insert(const std::vector< unsigned char > &vKey)
bool IsWithinSizeConstraints() const
True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS (c...
bool contains(const std::vector< unsigned char > &vKey) const
An outpoint - a combination of a transaction hash and an index n into its vout.
std::vector< uint64_t > data
int nEntriesThisGeneration
friend class CRollingBloomFilter
void UpdateEmptyFull()
Checks for empty and full filters to avoid wasting cpu.
The basic transaction that is broadcasted on the network and contained in blocks. ...
void SerializationOp(Stream &s, Operation ser_action)
int nEntriesPerGeneration