5#ifndef BITCOIN_COMMON_BLOOM_H
6#define BITCOIN_COMMON_BLOOM_H
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.
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.
A Span is an object that can refer to a contiguous sequence of objects.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...