Skip to content

Commit

Permalink
check market protocol before making boost deal (#843)
Browse files Browse the repository at this point in the history
* check market protocol before deal

* implement suggestions

* Update cmd/boost/deal_cmd.go

Co-authored-by: Anton Evangelatov <anton.evangelatov@gmail.com>

* use FirstSupportedProtocol method

Co-authored-by: Anton Evangelatov <anton.evangelatov@gmail.com>
  • Loading branch information
LexLuthr and nonsense authored Sep 29, 2022
1 parent da01992 commit adcebf9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/boost/deal_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ func dealCmdAction(cctx *cli.Context, isOnline bool) error {
return fmt.Errorf("failed to connect to peer %s: %w", addrInfo.ID, err)
}

x, err := n.Host.Peerstore().FirstSupportedProtocol(addrInfo.ID, DealProtocolv120)
if err != nil {
return fmt.Errorf("getting protocols for peer %s: %w", addrInfo.ID, err)
}

if len(x) == 0 {
return fmt.Errorf("boost client cannot make a deal with storage provider because it does not support protocol version 1.2.0")
}

dealUuid := uuid.New()

commp := cctx.String("commp")
Expand Down

0 comments on commit adcebf9

Please sign in to comment.