From 91132f85f0758111632a65857a086d8b48793514 Mon Sep 17 00:00:00 2001
From: joshemb <josh@elixxir.io>
Date: Tue, 23 Aug 2022 17:24:43 -0700
Subject: [PATCH] Add empty residue check to AddFirst

---
 e2e/parse/partition/store.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/e2e/parse/partition/store.go b/e2e/parse/partition/store.go
index 9db972575..a8ba36bd9 100644
--- a/e2e/parse/partition/store.go
+++ b/e2e/parse/partition/store.go
@@ -8,6 +8,7 @@
 package partition
 
 import (
+	"bytes"
 	"encoding/binary"
 	"encoding/json"
 	jww "github.com/spf13/jwalterweatherman"
@@ -58,6 +59,12 @@ func (s *Store) AddFirst(partner *id.ID, mt catalog.MessageType,
 
 	mpm := s.load(partner, messageID)
 	mpm.AddFirst(mt, partNum, numParts, senderTimestamp, storageTimestamp, part)
+	if bytes.Equal(residue.Marshal(), []byte{}) {
+		// fixme: should this error or crash?
+		jww.WARN.Printf("Key reside from first message " +
+			"is empty, continuing...")
+	}
+
 	mpm.KeyResidue = residue
 	msg, ok := mpm.IsComplete(relationshipFingerprint)
 
-- 
GitLab