From ed4748e8acd1eb10d99f7f3a5d5073761dea3e18 Mon Sep 17 00:00:00 2001 From: aarshkshah1992 Date: Fri, 2 Apr 2021 16:05:14 +0530 Subject: [PATCH] fix bug --- cli/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/client.go b/cli/client.go index c5d614421..f31b4dcfb 100644 --- a/cli/client.go +++ b/cli/client.go @@ -1185,6 +1185,8 @@ var clientRetrieveCmd = &cli.Command{ return xerrors.Errorf("error setting up retrieval: %w", err) } + var prevStatus retrievalmarket.DealStatus + for { select { case evt, ok := <-updates: @@ -1195,6 +1197,7 @@ var clientRetrieveCmd = &cli.Command{ retrievalmarket.ClientEvents[evt.Event], retrievalmarket.DealStatuses[evt.Status], ) + prevStatus = evt.Status } if evt.Err != "" { @@ -1202,10 +1205,11 @@ var clientRetrieveCmd = &cli.Command{ } if !ok { - if evt.Status == retrievalmarket.DealStatusCompleted { + if prevStatus == retrievalmarket.DealStatusCompleted { afmt.Println("Success") } else { - afmt.Printf("saw final deal state %s instead of expected success state DealStatusCompleted", retrievalmarket.DealStatuses[evt.Status]) + afmt.Printf("saw final deal state %s instead of expected success state DealStatusCompleted", + retrievalmarket.DealStatuses[prevStatus]) } return nil }