From 23ed9e39ca306762782ee98b59905965189e4b76 Mon Sep 17 00:00:00 2001 From: joshemb <josh@elixxir.io> Date: Thu, 28 Jul 2022 12:12:31 -0700 Subject: [PATCH] Respond to MR comments --- cmd/getndf.go | 5 ++--- xxdk/ndf.go | 12 ++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/getndf.go b/cmd/getndf.go index 4a2145385..8a1079605 100644 --- a/cmd/getndf.go +++ b/cmd/getndf.go @@ -101,12 +101,11 @@ var getNDFCmd = &cobra.Command{ // Gateway lookup if gwHost != "" { - resp, err := xxdk.DownloadNdfFromGateway(gwHost, cert) - fmt.Printf("%s", resp.PartialNDF.Ndf) + ndfJSon, err := xxdk.DownloadNdfFromGateway(gwHost, cert) if err != nil { jww.FATAL.Panicf("%v", err) } - fmt.Printf("%s", resp.PartialNDF.Ndf) + fmt.Printf("%s", ndfJSon) return } diff --git a/xxdk/ndf.go b/xxdk/ndf.go index 861fea406..a5e2ae703 100644 --- a/xxdk/ndf.go +++ b/xxdk/ndf.go @@ -26,10 +26,9 @@ import ( // DownloadNdfFromGateway will download an NDF from a gateway on the cMix network. // It will take the given address and certificate and send a request to a gateway // for an NDF over HTTP/2 using the xx network's gRPC implementation. -// This returns a gRPC protobuf message which contains the NDF in the -// PartialNDF field of the pb.GatewayPollResponse. +// This returns a JSON marshalled version of the NDF. func DownloadNdfFromGateway(address string, cert []byte) ( - *pb.GatewayPollResponse, error) { + []byte, error) { // Establish parameters for gRPC params := connect.GetDefaultHostParams() params.AuthEnabled = false @@ -60,7 +59,12 @@ func DownloadNdfFromGateway(address string, cert []byte) ( } // Send poll request and receive response containing NDF - return comms.SendPoll(host, pollMsg) + resp, err := comms.SendPoll(host, pollMsg) + if err != nil { + return nil, err + } + + return resp.PartialNDF.Ndf, nil } // DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. -- GitLab