From 109fdc47cbd57ca60aa6fb9707a3ed7cb8680426 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Tue, 23 Feb 2021 17:15:56 -0800
Subject: [PATCH] fixed historical rounds

---
 network/rounds/historical.go | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/network/rounds/historical.go b/network/rounds/historical.go
index b10e8102a..1cc6c91a8 100644
--- a/network/rounds/historical.go
+++ b/network/rounds/historical.go
@@ -73,10 +73,12 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c
 			}
 		// get new round to lookup and force a lookup if
 		case r := <-m.historicalRounds:
+			jww.DEBUG.Printf("Recieved and quing round %d for " +
+				"historical rounds lookup", r.rid)
 			roundRequests = append(roundRequests, r)
 			if len(roundRequests) > int(m.params.MaxHistoricalRounds) {
 				shouldProcess = true
-			} else if len(roundRequests) == 1 {
+			} else if len(roundRequests) != 0 {
 				//if this is the first round, start the timeout
 				timerCh = time.NewTimer(m.params.HistoricalRoundsPeriod).C
 			}
@@ -102,7 +104,7 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c
 			Rounds: rounds,
 		}
 
-		jww.DEBUG.Printf("Requesting Historical rounds (%v) from " +
+		jww.DEBUG.Printf("Requesting Historical rounds %v from " +
 			"gateway %s", rounds, gwHost.GetId())
 
 		response, err := comm.RequestHistoricalRounds(gwHost, hr)
@@ -121,7 +123,7 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c
 			// need be be removes as processing so the network follower will
 			// pick them up in the future.
 			if roundInfo == nil {
-				jww.ERROR.Printf("could not retreive "+
+				jww.ERROR.Printf("Failed to retreive "+
 					"historical round %d", roundRequests[i].rid)
 				m.p.Fail(roundRequests[i].rid)
 				continue
@@ -134,5 +136,8 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c
 			}
 			m.lookupRoundMessages <- rl
 		}
+
+		//clear the buffer now that all have been checked
+		roundRequests = make([]historicalRoundRequest, 0)
 	}
 }
-- 
GitLab