Replace setInventoryKnown with a rolling bloom filter.
Github-Pull: #7133 Rebased-From:ec73ef37ece20672479e6b849350abb6a0da45dbd41e44c9acaa4b0c26b0
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
6ba25d2886
commit
f31955d9da
10
src/net.h
10
src/net.h
@@ -9,7 +9,6 @@
|
||||
#include "bloom.h"
|
||||
#include "compat.h"
|
||||
#include "limitedmap.h"
|
||||
#include "mruset.h"
|
||||
#include "netbase.h"
|
||||
#include "protocol.h"
|
||||
#include "random.h"
|
||||
@@ -388,7 +387,7 @@ public:
|
||||
std::set<uint256> setKnown;
|
||||
|
||||
// inventory based relay
|
||||
mruset<CInv> setInventoryKnown;
|
||||
CRollingBloomFilter filterInventoryKnown;
|
||||
std::vector<CInv> vInventoryToSend;
|
||||
CCriticalSection cs_inventory;
|
||||
std::set<uint256> setAskFor;
|
||||
@@ -497,7 +496,7 @@ public:
|
||||
{
|
||||
{
|
||||
LOCK(cs_inventory);
|
||||
setInventoryKnown.insert(inv);
|
||||
filterInventoryKnown.insert(inv.hash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,8 +504,9 @@ public:
|
||||
{
|
||||
{
|
||||
LOCK(cs_inventory);
|
||||
if (!setInventoryKnown.count(inv))
|
||||
vInventoryToSend.push_back(inv);
|
||||
if (inv.type == MSG_TX && filterInventoryKnown.contains(inv.hash))
|
||||
return;
|
||||
vInventoryToSend.push_back(inv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user