Performance optimization for bloom filters.

This reduces a peer's ability to attack network resources by
 using a full bloom filter, but without reducing the usability
 of bloom filters.  It sets a default match everything filter
 for peers and it generalizes a prior optimization to
 cover more cases.
This commit is contained in:
Gregory Maxwell
2013-08-18 20:21:06 -07:00
parent 4bc9a19269
commit 37c6389c5a
4 changed files with 33 additions and 7 deletions

View File

@@ -3893,6 +3893,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LOCK(pfrom->cs_filter);
delete pfrom->pfilter;
pfrom->pfilter = new CBloomFilter(filter);
filter.UpdateEmptyFull();
}
pfrom->fRelayTxes = true;
}
@@ -3922,7 +3923,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
LOCK(pfrom->cs_filter);
delete pfrom->pfilter;
pfrom->pfilter = NULL;
pfrom->pfilter = new CBloomFilter();
pfrom->fRelayTxes = true;
}