From b109c4ceee195e15f0573a715d8f7c31129f5520 Mon Sep 17 00:00:00 2001 From: Yusef Napora Date: Thu, 14 May 2020 13:35:12 -0400 Subject: [PATCH] check reject reason before deleting near-first state --- tag_tracer.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tag_tracer.go b/tag_tracer.go index def9498..379a8c4 100644 --- a/tag_tracer.go +++ b/tag_tracer.go @@ -249,8 +249,17 @@ func (t *tagTracer) RejectMessage(msg *Message, reason string) { t.Lock() defer t.Unlock() - // stop tracking near-first deliveries for rejected message - delete(t.nearFirst, t.msgID(msg.Message)) + // We want to delete the near-first delivery tracking for messages that have passed through + // the validation pipeline. Other rejection reasons (missing signature, etc) skip the validation + // queue, so we don't want to remove the state in case the message is still validating. + switch reason { + case rejectValidationThrottled: + fallthrough + case rejectValidationIgnored: + fallthrough + case rejectValidationFailed: + delete(t.nearFirst, t.msgID(msg.Message)) + } } func (t *tagTracer) RemovePeer(peer.ID) {}