Merge pull request #3123 from filecoin-project/fix/retrieval-nil-serializing
Fix/retrieval nil serializing
This commit is contained in:
commit
dfa2ac6807
@ -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
|
||||
}
|
||||
|
@ -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 == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user