From 4b55053bfb48da621ce20b0a2470668bb4be90df Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 22 Jan 2019 00:47:12 +0200 Subject: [PATCH] add early timecache check for already validated messages --- pubsub.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pubsub.go b/pubsub.go index 2a34bee..79e48d0 100644 --- a/pubsub.go +++ b/pubsub.go @@ -625,6 +625,12 @@ func (p *PubSub) pushMsg(vals []*topicVal, src peer.ID, msg *Message) { return } + // have we already seen and validated this message? + id := msgID(msg.Message) + if p.seenMessage(id) { + return + } + if len(vals) > 0 || msg.Signature != nil { // validation is asynchronous and globally throttled with the throttleValidate semaphore. // the purpose of the global throttle is to bound the goncurrency possible from incoming