Skip to content
Browse files

Merge pull request #2338 from TheBlueMatt/bloom

Short-circuit bloom checking if we will always return true.
  • Loading branch information...
2 parents 0bd573d + cbfc773 commit 65497f4ee77166ba2a803c51893a4eb5a401fdb9 @gavinandresen gavinandresen committed Feb 26, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/bloom.cpp
View
4 src/bloom.cpp
@@ -37,6 +37,8 @@ inline unsigned int CBloomFilter::Hash(unsigned int nHashNum, const std::vector<
void CBloomFilter::insert(const vector<unsigned char>& vKey)
{
+ if (vData.size() == 1 && vData[0] == 0xff)
+ return;
for (unsigned int i = 0; i < nHashFuncs; i++)
{
unsigned int nIndex = Hash(i, vKey);
@@ -61,6 +63,8 @@ void CBloomFilter::insert(const uint256& hash)
bool CBloomFilter::contains(const vector<unsigned char>& vKey) const
{
+ if (vData.size() == 1 && vData[0] == 0xff)
+ return true;
for (unsigned int i = 0; i < nHashFuncs; i++)
{
unsigned int nIndex = Hash(i, vKey);

0 comments on commit 65497f4

Please sign in to comment.
Something went wrong with that request. Please try again.