Changeset View
Changeset View
Standalone View
Standalone View
src/bloom.cpp
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | void CBloomFilter::reset(uint32_t nNewTweak) { | ||||
nTweak = nNewTweak; | nTweak = nNewTweak; | ||||
} | } | ||||
bool CBloomFilter::IsWithinSizeConstraints() const { | bool CBloomFilter::IsWithinSizeConstraints() const { | ||||
return vData.size() <= MAX_BLOOM_FILTER_SIZE && | return vData.size() <= MAX_BLOOM_FILTER_SIZE && | ||||
nHashFuncs <= MAX_HASH_FUNCS; | nHashFuncs <= MAX_HASH_FUNCS; | ||||
} | } | ||||
bool CBloomFilter::IsRelevantAndUpdate(const CTransaction &tx) { | bool CBloomFilter::MatchAndInsertOutputs(const CTransaction &tx) { | ||||
bool fFound = false; | bool fFound = false; | ||||
// Match if the filter contains the hash of tx for finding tx when they | // Match if the filter contains the hash of tx for finding tx when they | ||||
// appear in a block | // appear in a block | ||||
if (isFull) { | if (isFull) { | ||||
return true; | return true; | ||||
} | } | ||||
if (isEmpty) { | if (isEmpty) { | ||||
return false; | return false; | ||||
Show All 32 Lines | for (size_t i = 0; i < tx.vout.size(); i++) { | ||||
insert(COutPoint(txid, i)); | insert(COutPoint(txid, i)); | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (fFound) { | return fFound; | ||||
return true; | } | ||||
bool CBloomFilter::MatchInputs(const CTransaction &tx) { | |||||
if (isEmpty) { | |||||
return false; | |||||
} | } | ||||
for (const CTxIn &txin : tx.vin) { | for (const CTxIn &txin : tx.vin) { | ||||
// Match if the filter contains an outpoint tx spends | // Match if the filter contains an outpoint tx spends | ||||
if (contains(txin.prevout)) { | if (contains(txin.prevout)) { | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |