mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge pull request #2338 from TheBlueMatt/bloom
Short-circuit bloom checking if we will always return true.
This commit is contained in:
commit
65497f4ee7
@ -37,6 +37,8 @@ inline unsigned int CBloomFilter::Hash(unsigned int nHashNum, const std::vector<
|
|||||||
|
|
||||||
void CBloomFilter::insert(const vector<unsigned char>& vKey)
|
void CBloomFilter::insert(const vector<unsigned char>& vKey)
|
||||||
{
|
{
|
||||||
|
if (vData.size() == 1 && vData[0] == 0xff)
|
||||||
|
return;
|
||||||
for (unsigned int i = 0; i < nHashFuncs; i++)
|
for (unsigned int i = 0; i < nHashFuncs; i++)
|
||||||
{
|
{
|
||||||
unsigned int nIndex = Hash(i, vKey);
|
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
|
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++)
|
for (unsigned int i = 0; i < nHashFuncs; i++)
|
||||||
{
|
{
|
||||||
unsigned int nIndex = Hash(i, vKey);
|
unsigned int nIndex = Hash(i, vKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user