Merge pull request #4998 from filecoin-project/asr/json-deal

Default StartDealParams's fast retrieval field to true over JSON
This commit is contained in:
Łukasz Magiera 2020-11-25 19:32:30 +01:00 committed by GitHub
commit 7904f135ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package api
import (
"context"
"encoding/json"
"fmt"
"time"
@ -785,6 +786,22 @@ type StartDealParams struct {
VerifiedDeal bool
}
func (s *StartDealParams) UnmarshalJSON(raw []byte) (err error) {
type sdpAlias StartDealParams
sdp := sdpAlias{
FastRetrieval: true,
}
if err := json.Unmarshal(raw, &sdp); err != nil {
return err
}
*s = StartDealParams(sdp)
return nil
}
type IpldObject struct {
Cid cid.Cid
Obj interface{}