aboutsummaryrefslogtreecommitdiffstats
path: root/whisperTopic.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-02-02 14:48:52 +0800
committerGav Wood <i@gavwood.com>2015-02-02 14:48:52 +0800
commitbd3fed43b9710b77670bd8b3f04e90d25f311459 (patch)
treec6b2c38df6f39402453c6c5b597a70ba8af8b46f /whisperTopic.cpp
parentded08e82a709002caa19cae82b9df82768b5bd8e (diff)
downloaddexon-solidity-bd3fed43b9710b77670bd8b3f04e90d25f311459.tar.gz
dexon-solidity-bd3fed43b9710b77670bd8b3f04e90d25f311459.tar.zst
dexon-solidity-bd3fed43b9710b77670bd8b3f04e90d25f311459.zip
Don't count same messages twice.
Diffstat (limited to 'whisperTopic.cpp')
-rw-r--r--whisperTopic.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/whisperTopic.cpp b/whisperTopic.cpp
index 0162124b..11937336 100644
--- a/whisperTopic.cpp
+++ b/whisperTopic.cpp
@@ -50,6 +50,7 @@ BOOST_AUTO_TEST_CASE(topic)
auto w = wh->installWatch(BuildTopicMask("odd"));
started = true;
+ set<unsigned> received;
for (int iterout = 0, last = 0; iterout < 200 && last < 81; ++iterout)
{
@@ -57,6 +58,9 @@ BOOST_AUTO_TEST_CASE(topic)
{
Message msg = wh->envelope(i).open(wh->fullTopic(w));
last = RLP(msg.payload()).toInt<unsigned>();
+ if (received.count(last))
+ continue;
+ received.insert(last);
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
result += last;
}