WIP: trying to write a test to reproduce the storage deal error
This commit is contained in:
committed by
Łukasz Magiera
parent
e075eb163f
commit
9863942fe2
@@ -58,7 +58,7 @@ func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, miner address.A
|
||||
// TODO: make this a param
|
||||
self, err := a.WalletDefaultAddress(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("failed to get default address: %w", err)
|
||||
}
|
||||
|
||||
// get miner peerID
|
||||
@@ -70,11 +70,15 @@ func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, miner address.A
|
||||
|
||||
r, err := a.StateCall(ctx, msg, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("failed getting peer ID: %w", err)
|
||||
}
|
||||
if r.ExitCode != 0 {
|
||||
return nil, xerrors.Errorf("call to get peer ID for miner failed: exit code %d", r.ExitCode)
|
||||
}
|
||||
|
||||
pid, err := peer.IDFromBytes(r.Return)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("parsing peer ID wrong: %w", err)
|
||||
}
|
||||
|
||||
proposal := deals.ClientDealProposal{
|
||||
@@ -88,7 +92,12 @@ func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, miner address.A
|
||||
}
|
||||
|
||||
c, err := a.DealClient.Start(ctx, proposal)
|
||||
return &c, err
|
||||
// TODO: send updated voucher with PaymentVerifySector for cheaper validation (validate the sector the miner sent us first!)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to start deal: %w", err)
|
||||
}
|
||||
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
func (a *API) ClientListDeals(ctx context.Context) ([]api.DealInfo, error) {
|
||||
@@ -177,7 +186,11 @@ func (a *API) ClientImport(ctx context.Context, path string) (cid.Cid, error) {
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
||||
return nd.Cid(), bufferedDS.Commit()
|
||||
if err := bufferedDS.Commit(); err != nil {
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
||||
return nd.Cid(), nil
|
||||
}
|
||||
|
||||
func (a *API) ClientImportLocal(ctx context.Context, f io.Reader) (cid.Cid, error) {
|
||||
|
||||
Reference in New Issue
Block a user