Fix error handling in SectorAddPieceToAny api impl

This commit is contained in:
Łukasz Magiera 2021-08-19 12:56:40 +02:00
parent 28bf9688f1
commit 0beb48f11d

View File

@ -212,7 +212,13 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb
}
func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r sto.Data, d api.PieceDealInfo) (api.SectorOffset, error) {
return sm.Miner.SectorAddPieceToAny(ctx, size, r, d)
so, err := sm.Miner.SectorAddPieceToAny(ctx, size, r, d)
if err != nil {
// jsonrpc doesn't support returning values with errors, make sure we never do that
return api.SectorOffset{}, err
}
return so, nil
}
func (sm *StorageMinerAPI) SectorsUnsealPiece(ctx context.Context, sector sto.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error {