Changeset View
Changeset View
Standalone View
Standalone View
src/bloom.h
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | public: | ||||
void clear(); | void clear(); | ||||
void reset(uint32_t nNewTweak); | void reset(uint32_t nNewTweak); | ||||
//! True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash | //! True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash | ||||
//! functions is <= MAX_HASH_FUNCS (catch a filter which was just | //! functions is <= MAX_HASH_FUNCS (catch a filter which was just | ||||
//! deserialized which was too big) | //! deserialized which was too big) | ||||
bool IsWithinSizeConstraints() const; | bool IsWithinSizeConstraints() const; | ||||
//! First part of IsRelevantAndUpdate, which examines just outputs and | |||||
//! adds coins to the filter. | |||||
bool HasRelevantOutputsAndUpdate(const CTransaction &tx); | |||||
//! Second part of IsRelevantAndUpdate, which examines just inputs. | |||||
bool HasRelevantInputs(const CTransaction &tx); | |||||
//! Also adds any outputs which match the filter to the filter (to match | //! Also adds any outputs which match the filter to the filter (to match | ||||
//! their spending txes) | //! their spending txes) | ||||
bool IsRelevantAndUpdate(const CTransaction &tx); | bool IsRelevantAndUpdate(const CTransaction &tx) { | ||||
return HasRelevantOutputsAndUpdate(tx) || HasRelevantInputs(tx); | |||||
} | |||||
//! Checks for empty and full filters to avoid wasting cpu | //! Checks for empty and full filters to avoid wasting cpu | ||||
void UpdateEmptyFull(); | void UpdateEmptyFull(); | ||||
}; | }; | ||||
/** | /** | ||||
* RollingBloomFilter is a probabilistic "keep track of most recently inserted" | * RollingBloomFilter is a probabilistic "keep track of most recently inserted" | ||||
* set. Construct it with the number of items to keep track of, and a | * set. Construct it with the number of items to keep track of, and a | ||||
Show All 35 Lines |