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; | ||||
//! Scans output scripts for matches and adds those outpoints to the filter | |||||
//! for spend detection. Returns true if any output matched, or the txid | |||||
//! matches. | |||||
bool MatchAndInsertOutputs(const CTransaction &tx); | |||||
//! Scan inputs to see if the spent outpoints are a match, or the input | |||||
//! scripts contain matching elements. | |||||
bool MatchInputs(const CTransaction &tx); | |||||
//! Check if the transaction is relevant for any reason. | |||||
//! 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 MatchAndInsertOutputs(tx) || MatchInputs(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 |