More post-refactor fixes
This commit is contained in:
+3
-3
@@ -38,9 +38,9 @@ type Miner struct {
|
||||
schedPost uint64
|
||||
|
||||
// Sealing
|
||||
sb *sectorbuilder.SectorBuilder
|
||||
sb *sectorbuilder.SectorBuilder
|
||||
sectors *statestore.StateStore
|
||||
tktFn TicketFn
|
||||
tktFn TicketFn
|
||||
|
||||
sectorIncoming chan *SectorInfo
|
||||
sectorUpdated chan sectorUpdate
|
||||
@@ -80,7 +80,7 @@ func NewMiner(api storageMinerApi, addr address.Address, h host.Host, ds datasto
|
||||
|
||||
maddr: addr,
|
||||
h: h,
|
||||
sb: sb,
|
||||
sb: sb,
|
||||
tktFn: tktFn,
|
||||
|
||||
sectors: statestore.New(namespace.Wrap(ds, datastore.NewKey("/sectors"))),
|
||||
|
||||
+7
-7
@@ -7,9 +7,9 @@ import (
|
||||
cid "github.com/ipfs/go-cid"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
)
|
||||
|
||||
type TicketFn func(context.Context) (*sectorbuilder.SealTicket, error)
|
||||
@@ -27,9 +27,9 @@ func (t *SealTicket) sb() sectorbuilder.SealTicket {
|
||||
|
||||
type Piece struct {
|
||||
DealID uint64
|
||||
Ref string
|
||||
Ref string
|
||||
|
||||
Size uint64
|
||||
Size uint64
|
||||
CommP []byte
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ type SectorInfo struct {
|
||||
CommD []byte
|
||||
CommR []byte
|
||||
CommRLast []byte
|
||||
Ticket SealTicket
|
||||
Ticket SealTicket
|
||||
|
||||
PreCommitMessage *cid.Cid
|
||||
|
||||
@@ -219,10 +219,10 @@ func (m *Miner) newSector(ctx context.Context, sid uint64, dealID uint64, ref st
|
||||
Pieces: []Piece{
|
||||
{
|
||||
DealID: dealID,
|
||||
Ref:ref,
|
||||
Ref: ref,
|
||||
|
||||
Size: ppi.Size,
|
||||
CommP: ppi.CommP[:],
|
||||
Size: ppi.Size,
|
||||
CommP: ppi.CommP[:],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -43,11 +43,13 @@ func (m *Miner) finishPacking(ctx context.Context, sector SectorInfo) (func(*Sec
|
||||
allocated += piece.Size
|
||||
}
|
||||
|
||||
if allocated > m.sb.SectorSize() {
|
||||
return nil, xerrors.Errorf("too much data in sector: %d > %d", allocated, m.sb.SectorSize())
|
||||
ubytes := sectorbuilder.UserBytesForSectorSize(m.sb.SectorSize())
|
||||
|
||||
if allocated > ubytes {
|
||||
return nil, xerrors.Errorf("too much data in sector: %d > %d", allocated, ubytes)
|
||||
}
|
||||
|
||||
fillerSizes, err := fillersFromRem(m.sb.SectorSize() - allocated)
|
||||
fillerSizes, err := fillersFromRem(ubytes - allocated)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user