From 46e93488e8cbb11c5fd9700d013da830386efbeb Mon Sep 17 00:00:00 2001
From: joshemb <josh@elixxir.io>
Date: Tue, 16 Aug 2022 14:04:48 -0700
Subject: [PATCH] Add debug statement to discern error

---
 bindings/e2e.go | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/bindings/e2e.go b/bindings/e2e.go
index f9c302bcf..3c5109968 100644
--- a/bindings/e2e.go
+++ b/bindings/e2e.go
@@ -145,19 +145,34 @@ func (e *E2e) GetUdCertFromNdf() []byte {
 // Returns
 //  - []byte - A byte marshalled contact.Contact.
 func (e *E2e) GetUdContactFromNdf() ([]byte, error) {
-	udIdData := e.api.GetCmix().GetInstance().GetPartialNdf().Get().UDB.ID
+	// Retrieve data from E2e
+	netDef := e.api.GetCmix().GetInstance().GetPartialNdf().Get()
+	e2eGroup := e.api.GetE2E().GetGroup()
+
+	// Unmarshal UD ID
+	udIdData := netDef.UDB.ID
 	udId, err := id.Unmarshal(udIdData)
 	if err != nil {
 		return nil, err
 	}
 
-	udDhPubKeyData := e.api.GetCmix().GetInstance().GetPartialNdf().Get().UDB.DhPubKey
-	udDhPubKey := e.api.GetE2E().GetGroup().NewInt(1)
+	// Unmarshal DH pub key
+	udDhPubKeyData := netDef.UDB.DhPubKey
+	udDhPubKey := e2eGroup.NewInt(1)
 	err = udDhPubKey.UnmarshalJSON(udDhPubKeyData)
+
+	jww.WARN.Printf("GetUdContactFromNdf debug\n"+
+		"netDef UD: %v\n"+
+		"netDef DHPubKey: %v\n"+
+		"udDhPubKey.UnmarshalJSON (key:%v, err: %v)\n",
+		netDef.UDB, netDef.UDB.DhPubKey, udDhPubKey, err)
+
 	if err != nil {
+		jww.WARN.Printf("GetUdContactFromNdf debug fails on udDhPubKey.UnmarshalJSON")
 		return nil, err
 	}
 
+	// Construct contact
 	udContact := contact.Contact{
 		ID:       udId,
 		DhPubKey: udDhPubKey,
-- 
GitLab