integrate client interface to allow for offline deals

This commit is contained in:
whyrusleeping
2020-03-03 16:18:08 -08:00
parent 0025b3c1dc
commit 99c842e027
12 changed files with 134 additions and 67 deletions
+3 -6
View File
@@ -58,7 +58,7 @@ type API struct {
Filestore dtypes.ClientFilestore `optional:"true"`
}
func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, addr address.Address, miner address.Address, epochPrice types.BigInt, blocksDuration uint64) (*cid.Cid, error) {
func (a *API) ClientStartDeal(ctx context.Context, data *storagemarket.DataRef, addr address.Address, miner address.Address, epochPrice types.BigInt, blocksDuration uint64) (*cid.Cid, error) {
exist, err := a.WalletHas(ctx, addr)
if err != nil {
return nil, xerrors.Errorf("failed getting addr from wallet: %w", addr)
@@ -96,10 +96,7 @@ func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, addr address.Ad
ctx,
addr,
&providerInfo,
&storagemarket.DataRef{
TransferType: storagemarket.TTGraphsync,
Root: data,
},
data,
ts.Height()+dealStartBuffer,
ts.Height()+dealStartBuffer+abi.ChainEpoch(blocksDuration),
epochPrice,
@@ -332,7 +329,7 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
return xerrors.New("Retrieval Timed Out")
case err := <-retrievalResult:
if err != nil {
return xerrors.Errorf("Retrieve: %w", err)
return xerrors.Errorf("RetrieveUnixfs: %w", err)
}
}