diff --git a/libwhisper/Interface.h b/libwhisper/Interface.h index 941cf3434..f53cb17a7 100644 --- a/libwhisper/Interface.h +++ b/libwhisper/Interface.h @@ -67,7 +67,6 @@ public: virtual Topics const& fullTopics(unsigned _id) const = 0; virtual unsigned installWatch(Topics const& _filter) = 0; -// virtual unsigned installWatchOnId(h256 _filterId) = 0; virtual void uninstallWatch(unsigned _watchId) = 0; virtual h256s peekWatch(unsigned _watchId) const = 0; virtual h256s checkWatch(unsigned _watchId) = 0; diff --git a/libwhisper/WhisperHost.h b/libwhisper/WhisperHost.h index 386153ac5..1a43eda3a 100644 --- a/libwhisper/WhisperHost.h +++ b/libwhisper/WhisperHost.h @@ -51,7 +51,8 @@ public: WhisperHost(); virtual ~WhisperHost(); unsigned protocolVersion() const { return WhisperProtocolVersion; } - void cleanup(); ///< remove old messages + /// remove old messages + void cleanup(); std::map all() const { dev::ReadGuard l(x_messages); return m_messages; } FixedHash bloom() const { dev::Guard l(m_filterLock); return m_bloom; } @@ -61,7 +62,8 @@ public: virtual void uninstallWatch(unsigned _watchId) override; virtual h256s peekWatch(unsigned _watchId) const override { dev::Guard l(m_filterLock); try { return m_watches.at(_watchId).changes; } catch (...) { return h256s(); } } virtual h256s checkWatch(unsigned _watchId) override { cleanup(); dev::Guard l(m_filterLock); h256s ret; try { ret = m_watches.at(_watchId).changes; m_watches.at(_watchId).changes.clear(); } catch (...) {} return ret; } - virtual h256s watchMessages(unsigned _watchId) override; ///< returns IDs of messages, which match specific watch criteria + /// returns IDs of messages, which match specific watch criteria + virtual h256s watchMessages(unsigned _watchId) override; virtual Envelope envelope(h256 _m) const override { try { dev::ReadGuard l(x_messages); return m_messages.at(_m); } catch (...) { return Envelope(); } } protected: diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp index 7fe363033..3e71ca305 100644 --- a/test/libwhisper/bloomFilter.cpp +++ b/test/libwhisper/bloomFilter.cpp @@ -58,7 +58,7 @@ void testRemoveExistingBloom(TopicBloomFilterShort& _f, AbridgedTopic const& _h) BOOST_REQUIRE(!_f.containsBloom(_h)); } -double calculateExpected(TopicBloomFilterTest const& f, int const n) +double calculateExpected(TopicBloomFilterTest const& f, int n) { int const m = f.size * 8; // number of bits in the bloom int const k = f.BitsPerBloom; // number of hash functions (e.g. bits set to 1 in every bloom) @@ -79,7 +79,7 @@ double calculateExpected(TopicBloomFilterTest const& f, int const n) return kBitsSet; } -double testFalsePositiveRate(TopicBloomFilterTest const& f, int const inserted, Topic& x) +double testFalsePositiveRate(TopicBloomFilterTest const& f, int inserted, Topic& x) { int const c_sampleSize = 1000; int falsePositive = 0; @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(falsePositiveRate) double expectedRate = 0; - for (int i = 1; i < 50 && expectedRate < 0.5; ++i) + for (int i = 1; i < 50 && isless(expectedRate, 0.5); ++i) { x = sha3(x); f.addBloom(AbridgedTopic(x));