From e5cc050ec1bc9ab6bbd697656f854ec069868a7a Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Sun, 10 Oct 2021 12:37:26 -0700
Subject: [PATCH] fixed round tracker denote

---
 network/roundTracking.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/network/roundTracking.go b/network/roundTracking.go
index cb56aa8d8..08ca3b749 100644
--- a/network/roundTracking.go
+++ b/network/roundTracking.go
@@ -60,7 +60,12 @@ func NewRoundTracker() *RoundTracker {
 func (rt *RoundTracker) denote(rid id.Round, state RoundState) {
 	rt.mux.Lock()
 	defer rt.mux.Unlock()
-	if storedState, exists := rt.state[rid]; exists || storedState > state {
+	// this ensures a lower state will not overwrite a higher state.
+	// eg. Unchecked does not overwrite MessageAvailable
+	if storedState, exists := rt.state[rid]; exists && storedState < state {
+		jww.TRACE.Printf("did not denote round %d because " +
+			"stored state of %s (%d) > passed state %s (%d)",
+			rid, storedState, storedState, state, state)
 		return
 	}
 	rt.state[rid] = state
-- 
GitLab