From 0c7962ce5fd6f80dd78901755d32390ad0f948e6 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Tue, 24 Nov 2020 18:06:47 -0500 Subject: [PATCH] Default StartDealParams's fast retrieval field to true when JSON unmarshalling --- api/api_full.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/api/api_full.go b/api/api_full.go index d5e97d3a6..1edebc4a6 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -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{}