From ec73ef37eccfeda76de55c4ff93ea54d4e69e1ec Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Thu, 26 Nov 2015 05:25:30 +0000 Subject: Replace setInventoryKnown with a rolling bloom filter. Mruset setInventoryKnown was reduced to a remarkably small 1000 entries as a side effect of sendbuffer size reductions in 2012. This removes setInventoryKnown filtering from merkleBlock responses because false positives there are especially unattractive and also because I'm not sure if there aren't race conditions around the relay pool that would cause some transactions there to be suppressed. (Also, ProcessGetData was accessing setInventoryKnown without taking the required lock.) --- src/net.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index fb299fb0b4..b0be3e6523 100644 --- a/src/net.h +++ b/src/net.h @@ -386,7 +386,7 @@ public: std::set setKnown; // inventory based relay - mruset setInventoryKnown; + CRollingBloomFilter setInventoryKnown; std::vector vInventoryToSend; CCriticalSection cs_inventory; std::multimap mapAskFor; @@ -494,7 +494,7 @@ public: { { LOCK(cs_inventory); - setInventoryKnown.insert(inv); + setInventoryKnown.insert(inv.hash); } } @@ -502,7 +502,7 @@ public: { { LOCK(cs_inventory); - if (!setInventoryKnown.count(inv)) + if (!setInventoryKnown.contains(inv.hash)) vInventoryToSend.push_back(inv); } } -- cgit v1.2.3 From e20672479ef7f2048c2e27494397641d47a4d88d Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Sat, 28 Nov 2015 13:19:59 +0000 Subject: Remove mruset as it is no longer used. --- src/net.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index b0be3e6523..0332c07331 100644 --- a/src/net.h +++ b/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" -- cgit v1.2.3 From 6b849350ab074a7ccb80ecbef387f59e1271ded6 Mon Sep 17 00:00:00 2001 From: Patick Strateman Date: Sun, 29 Nov 2015 01:52:51 -0800 Subject: Rename setInventoryKnown filterInventoryKnown --- src/net.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 0332c07331..7f3143510d 100644 --- a/src/net.h +++ b/src/net.h @@ -385,7 +385,7 @@ public: std::set setKnown; // inventory based relay - CRollingBloomFilter setInventoryKnown; + CRollingBloomFilter filterInventoryKnown; std::vector vInventoryToSend; CCriticalSection cs_inventory; std::multimap mapAskFor; @@ -493,7 +493,7 @@ public: { { LOCK(cs_inventory); - setInventoryKnown.insert(inv.hash); + filterInventoryKnown.insert(inv.hash); } } @@ -501,7 +501,7 @@ public: { { LOCK(cs_inventory); - if (!setInventoryKnown.contains(inv.hash)) + if (!filterInventoryKnown.contains(inv.hash)) vInventoryToSend.push_back(inv); } } -- cgit v1.2.3 From b6a0da45db8d534e7a77d1cebe382cd5d83ba9b8 Mon Sep 17 00:00:00 2001 From: Patick Strateman Date: Sun, 29 Nov 2015 01:56:00 -0800 Subject: Only use filterInventoryKnown with MSG_TX inventory messages. Previously this logic could erroneously filter a MSG_BLOCK inventory message. --- src/net.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 7f3143510d..25dea3fc3b 100644 --- a/src/net.h +++ b/src/net.h @@ -501,8 +501,9 @@ public: { { LOCK(cs_inventory); - if (!filterInventoryKnown.contains(inv.hash)) - vInventoryToSend.push_back(inv); + if (inv.type == MSG_TX && filterInventoryKnown.contains(inv.hash)) + return; + vInventoryToSend.push_back(inv); } } -- cgit v1.2.3