From cccf73db0483cc3945bf8389ce197df35e931e16 Mon Sep 17 00:00:00 2001 From: Robert McLaughlin Date: Tue, 1 Nov 2016 21:04:26 -0400 Subject: [PATCH] trivial: fix bloom filter init to isEmpty = true Fixes newly initialized bloom filters being constructed with isEmpty(false), which still works but loses the possible speedup when checking for key membership in an empty filter. --- src/bloom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bloom.cpp b/src/bloom.cpp index 2677652ad..d00befc61 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -34,7 +34,7 @@ CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int * See https://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas */ isFull(false), - isEmpty(false), + isEmpty(true), nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)), nTweak(nTweakIn), nFlags(nFlagsIn)