From 87dd38b9c3649d9536dac5012a483baef75e2bc9 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Mon, 10 Jan 2022 07:45:40 -0800
Subject: [PATCH] removed the hack for the network not being updated with the
 correct message format

---
 network/message/garbled.go              | 4 ++--
 network/message/garbled_test.go         | 2 +-
 network/message/handler.go              | 8 ++++----
 network/message/sendCmixUtils.go        | 2 +-
 storage/fileTransfer/receiveTransfer.go | 1 -
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/network/message/garbled.go b/network/message/garbled.go
index 1b4929e89..b2449ca9f 100644
--- a/network/message/garbled.go
+++ b/network/message/garbled.go
@@ -59,9 +59,9 @@ func (m *Manager) handleGarbledMessages() {
 	//try to decrypt every garbled message, excising those who's counts are too high
 	for grbldMsg, count, timestamp, has := garbledMsgs.Next(); has; grbldMsg, count, timestamp, has = garbledMsgs.Next() {
 		//if it exists, check against all in the list
-		modifiedContents := append([]byte{0}, grbldMsg.GetContents()...)
+		grbldContents := grbldMsg.GetContents()
 		identity := m.Session.GetUser().ReceptionID
-		_, forMe, _ := m.Session.GetEdge().Check(identity, grbldMsg.GetIdentityFP(), modifiedContents)
+		_, forMe, _ := m.Session.GetEdge().Check(identity, grbldMsg.GetIdentityFP(), grbldContents)
 		if forMe {
 			fingerprint := grbldMsg.GetKeyFP()
 			// Check if the key is there, process it if it is
diff --git a/network/message/garbled_test.go b/network/message/garbled_test.go
index b32e53dd2..4a0f7eda9 100644
--- a/network/message/garbled_test.go
+++ b/network/message/garbled_test.go
@@ -152,7 +152,7 @@ func TestManager_CheckGarbledMessages(t *testing.T) {
 	copy(fmp.Timestamp, ts)
 	msg.SetContents(fmp.Bytes())
 	encryptedMsg := key.Encrypt(msg)
-	msg.SetIdentityFP(fingerprint.IdentityFP(append([]byte{0}, msg.GetContents()...), preimage.Data)) // TODO: back this out after network update
+	msg.SetIdentityFP(fingerprint.IdentityFP( msg.GetContents(), preimage.Data))
 	i.Session.GetGarbledMessages().Add(encryptedMsg)
 
 	stop := stoppable.NewSingle("stop")
diff --git a/network/message/handler.go b/network/message/handler.go
index bc47864d7..7aa63e6ad 100644
--- a/network/message/handler.go
+++ b/network/message/handler.go
@@ -54,18 +54,18 @@ func (m *Manager) handleMessage(ecrMsg format.Message, bundle Bundle, edge *edge
 	var relationshipFingerprint []byte
 
 	//if it exists, check against all in the list
-	modifiedContents := append([]byte{0}, ecrMsg.GetContents()...)
-	has, forMe, _ := m.Session.GetEdge().Check(identity.Source, ecrMsg.GetIdentityFP(), modifiedContents)
+	ecrMsgContents := ecrMsg.GetContents()
+	has, forMe, _ := m.Session.GetEdge().Check(identity.Source, ecrMsg.GetIdentityFP(), ecrMsgContents)
 	if !has {
 		jww.INFO.Printf("checking backup %v", preimage.MakeDefault(identity.Source))
 		//if it doesnt exist, check against the default fingerprint for the identity
 		forMe = fingerprint2.CheckIdentityFP(ecrMsg.GetIdentityFP(),
-			modifiedContents, preimage.MakeDefault(identity.Source))
+			ecrMsgContents, preimage.MakeDefault(identity.Source))
 	}
 
 	if !forMe {
 		if jww.GetLogThreshold() == jww.LevelTrace {
-			expectedFP := fingerprint2.IdentityFP(modifiedContents,
+			expectedFP := fingerprint2.IdentityFP(ecrMsgContents,
 				preimage.MakeDefault(identity.Source))
 			jww.TRACE.Printf("Message for %d (%s) failed identity "+
 				"check: %v (expected-default) vs %v (received)", identity.EphId,
diff --git a/network/message/sendCmixUtils.go b/network/message/sendCmixUtils.go
index 15dc71962..ae2344415 100644
--- a/network/message/sendCmixUtils.go
+++ b/network/message/sendCmixUtils.go
@@ -155,7 +155,7 @@ func buildSlotMessage(msg format.Message, recipient *id.ID, target *id.ID,
 
 	// Set the identity fingerprint
 
-	ifp := fingerprint.IdentityFP(append([]byte{0}, msg.GetContents()...), preimage)
+	ifp := fingerprint.IdentityFP(msg.GetContents(), preimage)
 
 	msg.SetIdentityFP(ifp)
 
diff --git a/storage/fileTransfer/receiveTransfer.go b/storage/fileTransfer/receiveTransfer.go
index 785782ed5..b3e387a75 100644
--- a/storage/fileTransfer/receiveTransfer.go
+++ b/storage/fileTransfer/receiveTransfer.go
@@ -10,7 +10,6 @@ package fileTransfer
 import (
 	"bytes"
 	"encoding/binary"
-	"fmt"
 	"github.com/pkg/errors"
 	jww "github.com/spf13/jwalterweatherman"
 	"gitlab.com/elixxir/client/interfaces"
-- 
GitLab