Merge pull request #3123 from filecoin-project/fix/retrieval-nil-serializing

Fix/retrieval nil serializing
This commit is contained in:
Łukasz Magiera 2020-08-18 02:20:12 +02:00 committed by GitHub
commit dfa2ac6807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View File

@ -854,15 +854,15 @@ var clientRetrieveCmd = &cli.Command{
for {
select {
case evt, chOpen := <-updates:
fmt.Printf("> Recv: %s, Paid %s, %s (%s)\n",
types.SizeStr(types.NewInt(evt.BytesReceived)),
types.FIL(evt.FundsSpent),
retrievalmarket.ClientEvents[evt.Event],
retrievalmarket.DealStatuses[evt.Status],
)
if !chOpen {
case evt, ok := <-updates:
if ok {
fmt.Printf("> Recv: %s, Paid %s, %s (%s)\n",
types.SizeStr(types.NewInt(evt.BytesReceived)),
types.FIL(evt.FundsSpent),
retrievalmarket.ClientEvents[evt.Event],
retrievalmarket.DealStatuses[evt.Status],
)
} else {
fmt.Println("Success")
return nil
}

View File

@ -6,6 +6,7 @@ import (
"io"
"os"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"golang.org/x/xerrors"
"github.com/ipfs/go-blockservice"
@ -409,11 +410,9 @@ func (a *API) clientRetrieve(ctx context.Context, order api.RetrievalOrder, ref
defer close(events)
finish := func(e error) {
errStr := ""
if e != nil {
errStr = e.Error()
events <- marketevents.RetrievalEvent{Err: e.Error(), FundsSpent: big.Zero()}
}
events <- marketevents.RetrievalEvent{Err: errStr}
}
if order.MinerPeer.ID == "" {