From e08a127d601ce588721e0b03f1538504e1ab075f Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Mon, 15 Mar 2021 10:28:45 -0700 Subject: [PATCH] Rework funky logic in getFurthest --- network/dataStructures/waitingRounds.go | 4 +++- network/dataStructures/waitingRounds_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/network/dataStructures/waitingRounds.go b/network/dataStructures/waitingRounds.go index 7c659a9d..234c74a3 100644 --- a/network/dataStructures/waitingRounds.go +++ b/network/dataStructures/waitingRounds.go @@ -122,7 +122,9 @@ func (wr *WaitingRounds) getFurthest(exclude *set.Set) *Round { // Return the last non-excluded round in the list for e := wr.rounds.Back(); e != nil; e = e.Prev() { r := e.Value.(*Round) - if !exclude.Has(r) { + // Can't guarantee round object's pointers will + // be exact match of value in set + if !exclude.Has(r.info) { return r } } diff --git a/network/dataStructures/waitingRounds_test.go b/network/dataStructures/waitingRounds_test.go index 02837857..342c7371 100644 --- a/network/dataStructures/waitingRounds_test.go +++ b/network/dataStructures/waitingRounds_test.go @@ -132,7 +132,7 @@ func TestWaitingRounds_getFurthest_Exclude(t *testing.T) { exclude := set.New() for i, round := range expectedRounds { if i%2 == 0 { - exclude.Insert(round) + exclude.Insert(round.info) } } -- GitLab