This commit is contained in:
Łukasz Magiera 2019-08-27 21:54:39 +02:00
parent 6714240653
commit 433550e9a4
9 changed files with 23 additions and 27 deletions

View File

@ -133,7 +133,7 @@ func (m *Miner) HandleDealStream(stream network.Stream) { // TODO: should we blo
size = uint64(isize)
}
if deal.Unixfs0.Offset + deal.Unixfs0.Size > size {
if deal.Unixfs0.Offset+deal.Unixfs0.Size > size {
writeErr(stream, xerrors.Errorf("tried to read too much %d+%d > %d", deal.Unixfs0.Offset, deal.Unixfs0.Size, size))
return
}

View File

@ -3,21 +3,21 @@ package storage
import (
"context"
"fmt"
"github.com/filecoin-project/go-lotus/build"
"github.com/filecoin-project/go-lotus/storage/sector"
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/chain/actors"
"github.com/filecoin-project/go-lotus/chain/address"
"github.com/filecoin-project/go-lotus/chain/store"
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log"
host "github.com/libp2p/go-libp2p-core/host"
"github.com/pkg/errors"
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/build"
"github.com/filecoin-project/go-lotus/chain/actors"
"github.com/filecoin-project/go-lotus/chain/address"
"github.com/filecoin-project/go-lotus/chain/store"
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/filecoin-project/go-lotus/lib/sectorbuilder"
"github.com/filecoin-project/go-lotus/storage/sector"
)
var log = logging.Logger("storageminer")

View File

@ -201,4 +201,3 @@ func (st *SectorBlocks) SealedBlockstore(approveUnseal func() error) *SectorBloc
approveUnseal: approveUnseal,
}
}

View File

@ -74,5 +74,4 @@ func (s *SectorBlockStore) Get(c cid.Cid) (blocks.Block, error) {
return blocks.NewBlockWithCid(data, c)
}
var _ blockstore.Blockstore = &SectorBlockStore{}

View File

@ -31,7 +31,7 @@ func (ub *unsealedBlocks) getRef(ctx context.Context, refs []api.SealedRef, appr
b, ok := ub.unsealed[ref.Piece]
if ok {
ub.lk.Unlock()
return b[ref.Offset:ref.Offset + uint64(ref.Size)], nil // TODO: check slice math
return b[ref.Offset : ref.Offset+uint64(ref.Size)], nil // TODO: check slice math
}
// TODO: pick unsealing based on how long it's running (or just select all relevant, usually it'll be just one)
_, ok = ub.unsealing[ref.Piece]
@ -48,7 +48,7 @@ func (ub *unsealedBlocks) getRef(ctx context.Context, refs []api.SealedRef, appr
return nil, err
}
return b[best.Offset:best.Offset + uint64(best.Size)], nil // TODO: check slice math
return b[best.Offset : best.Offset+uint64(best.Size)], nil // TODO: check slice math
}
func (ub *unsealedBlocks) maybeUnseal(ctx context.Context, pieceKey string, approveUnseal func() error) ([]byte, error) {
@ -94,5 +94,3 @@ func (ub *unsealedBlocks) maybeUnseal(ctx context.Context, pieceKey string, appr
close(ub.unsealing[pieceKey])
return data, nil
}