5#ifndef BITCOIN_COMMON_BLOOM_H
6#define BITCOIN_COMMON_BLOOM_H
65 CBloomFilter(
const uint32_t nElements,
const double nFPRate,
66 const uint32_t
nTweak, uint8_t nFlagsIn);
70 READWRITE(obj.vData, obj.nHashFuncs, obj.nTweak, obj.nFlags);
static const uint32_t MAX_BLOOM_FILTER_SIZE
20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
static const uint32_t MAX_HASH_FUNCS
bloomflags
First two bits of nFlags control how much IsRelevantAndUpdate actually updates.
@ BLOOM_UPDATE_P2PUBKEY_ONLY
BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transaction...
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(Span< const uint8_t > vKey) const
void insert(Span< const uint8_t > vKey)
std::vector< uint8_t > vData
bool MatchInputs(const CTransaction &tx)
Scan inputs to see if the spent outpoints are a match, or the input scripts contain matching elements...
bool MatchAndInsertOutputs(const CTransaction &tx)
Scans output scripts for matches and adds those outpoints to the filter for spend detection.
uint32_t Hash(uint32_t nHashNum, Span< const uint8_t > vDataToHash) const
bool IsRelevantAndUpdate(const CTransaction &tx)
Check if the transaction is relevant for any reason.
SERIALIZE_METHODS(CBloomFilter, obj)
An outpoint - a combination of a transaction hash and an index n into its vout.
RollingBloomFilter is a probabilistic "keep track of most recently inserted" set.
CRollingBloomFilter(const uint32_t nElements, const double nFPRate)
int nEntriesPerGeneration
int nEntriesThisGeneration
std::vector< uint64_t > data
void insert(Span< const uint8_t > vKey)
bool contains(Span< const uint8_t > vKey) const
The basic transaction that is broadcasted on the network and contained in blocks.