From 30fdcee9e430b1db9aefa9aa63687a214274cf56 Mon Sep 17 00:00:00 2001
From: josh <josh@elixxir.io>
Date: Mon, 2 May 2022 10:35:33 -0700
Subject: [PATCH] Add more fixes

---
 cmix/identity/tracker.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/cmix/identity/tracker.go b/cmix/identity/tracker.go
index e62b4067c..394e9ac31 100644
--- a/cmix/identity/tracker.go
+++ b/cmix/identity/tracker.go
@@ -240,7 +240,9 @@ func (t *manager) track(stop *stoppable.Single) {
 func (t *manager) processIdentities(addressSize uint8) time.Time {
 	edits := false
 	toRemove := make(map[int]struct{})
-	nextEvent := t.tracked[0].ValidUntil
+	// Identities are rotated on a 24-hour time period. Set the event
+	// to the latest possible time so that any sooner times will overwrite this
+	nextEvent := netTime.Now().Add(time.Duration(ephemeral.Period))
 
 	// Loop through every tracked ID and see if any operations are needed
 	for i, inQuestion := range t.tracked {
@@ -263,13 +265,15 @@ func (t *manager) processIdentities(addressSize uint8) time.Time {
 			if inQuestion.NextGeneration.Before(nextEvent) {
 				nextEvent = inQuestion.NextGeneration
 			}
-			if inQuestion.ValidUntil != Forever && inQuestion.ValidUntil.Before(nextEvent) {
+			if !inQuestion.ValidUntil.IsZero() && inQuestion.ValidUntil.Before(nextEvent) {
 				nextEvent = inQuestion.ValidUntil
 			}
 		}
 
 	}
 
+	jww.INFO.Printf("[TrackedIDS] NextEvent: %s", nextEvent)
+
 	// Process any deletions
 	if len(toRemove) > 0 {
 		newTracked := make([]TrackedID, 0, len(t.tracked))
-- 
GitLab