Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default StartDealParams's fast retrieval field to true over JSON #4998

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"context"
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -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{}
Expand Down