From e6d6fb530432d18b8b8fa411a42a1338029465ea Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Thu, 1 Apr 2021 15:18:50 -0700
Subject: [PATCH] fixed an edge case in auth confirmation

---
 auth/callback.go       | 6 +++---
 network/follow.go      | 1 -
 network/polltracker.go | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/auth/callback.go b/auth/callback.go
index a304905f4..1963b7960 100644
--- a/auth/callback.go
+++ b/auth/callback.go
@@ -152,7 +152,7 @@ func (m *Manager) handleRequest(cmixMsg format.Message,
 					" msgDigest: %s which has been requested, auto-confirming",
 					partnerID, cmixMsg.Digest())
 				// do the confirmation
-				if err := m.doConfirm(sr2, grp, partnerPubKey, myPubKey,
+				if err := m.doConfirm(sr2, grp, partnerPubKey, sr2.GetPartnerHistoricalPubKey(),
 					ecrFmt.GetOwnership()); err != nil {
 					jww.WARN.Printf("Auto Confirmation with %s failed: %s",
 						partnerID, err)
@@ -250,10 +250,10 @@ func (m *Manager) handleConfirm(cmixMsg format.Message, sr *auth.SentRequest,
 }
 
 func (m *Manager) doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
-	partnerPubKey, myPubKeyOwnershipProof *cyclic.Int, ownershipProof []byte) error {
+	partnerPubKey, partnerPubKeyOwnershipProof *cyclic.Int, ownershipProof []byte) error {
 	// verify the message came from the intended recipient
 	if !cAuth.VerifyOwnershipProof(sr.GetMyPrivKey(),
-		myPubKeyOwnershipProof, grp, ownershipProof) {
+		partnerPubKeyOwnershipProof, grp, ownershipProof) {
 		return errors.Errorf("Failed authenticate identity for auth "+
 			"confirmation of %s", sr.GetPartner())
 	}
diff --git a/network/follow.go b/network/follow.go
index 930d8b860..a555874ad 100644
--- a/network/follow.go
+++ b/network/follow.go
@@ -41,7 +41,6 @@ import (
 )
 
 const debugTrackPeriod = 1 * time.Minute
-const maxChecked = 100000
 
 //comms interface makes testing easier
 type followNetworkComms interface {
diff --git a/network/polltracker.go b/network/polltracker.go
index 497539e94..48574c7d8 100644
--- a/network/polltracker.go
+++ b/network/polltracker.go
@@ -17,9 +17,9 @@ func newPollTracker() *pollTracker {
 func (pt *pollTracker) Track(ephID ephemeral.Id, source *id.ID) {
 	if _, exists := (*pt)[*source]; !exists {
 		(*pt)[*source] = make(map[int64]uint)
-		(*pt)[*source][ephID.Int64()] = 0
+		(*pt)[*source][ephID.Int64()] = 1
 	} else if _, exists := (*pt)[*source][ephID.Int64()]; !exists {
-		(*pt)[*source][ephID.Int64()] = 0
+		(*pt)[*source][ephID.Int64()] = 1
 	} else {
 		(*pt)[*source][ephID.Int64()] = (*pt)[*source][ephID.Int64()] + 1
 	}
-- 
GitLab