diff options
author | Gregory Maxwell <greg@xiph.org> | 2015-11-26 05:25:30 +0000 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-12-04 15:01:09 +0100 |
commit | f31955d9da152e5e849575f0297f8fe1904cbfbc (patch) | |
tree | 773fb64fc9c15b0000acb9e71ae1fd1c5145f245 /src/net.h | |
parent | 6ba25d28868146d5d6dbd671881db3a58f549567 (diff) | |
download | bitcoin-f31955d9da152e5e849575f0297f8fe1904cbfbc.tar.xz |
Replace setInventoryKnown with a rolling bloom filter.
Github-Pull: #7133
Rebased-From: ec73ef37eccfeda76de55c4ff93ea54d4e69e1ec e20672479ef7f2048c2e27494397641d47a4d88d 6b849350ab074a7ccb80ecbef387f59e1271ded6 b6a0da45db8d534e7a77d1cebe382cd5d83ba9b8 d41e44c9accb3df84e0abbc602cc76b72754d382 aa4b0c26b0a94ca6164c441aae723e118554d214
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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); } } |