seed: Call AcquireID for sectorIDs

This commit is contained in:
Łukasz Magiera 2019-11-27 12:57:52 +01:00
parent 2ec4e8a2fa
commit 03b1d2329f
5 changed files with 16 additions and 7 deletions

View File

@ -3,8 +3,8 @@ package gen
import (
"context"
amt "github.com/filecoin-project/go-amt-ipld"
bls "github.com/filecoin-project/filecoin-ffi"
amt "github.com/filecoin-project/go-amt-ipld"
cid "github.com/ipfs/go-cid"
hamt "github.com/ipfs/go-hamt-ipld"
cbg "github.com/whyrusleeping/cbor-gen"

View File

@ -10,8 +10,8 @@ import (
"time"
"github.com/Gurpartap/async"
amt "github.com/filecoin-project/go-amt-ipld"
bls "github.com/filecoin-project/filecoin-ffi"
amt "github.com/filecoin-project/go-amt-ipld"
"github.com/hashicorp/go-multierror"
"github.com/ipfs/go-cid"
dstore "github.com/ipfs/go-datastore"

View File

@ -123,7 +123,12 @@ var preSealCmd = &cli.Command{
var sealedSectors []genesis.PreSeal
for i := uint64(1); i <= c.Uint64("num-sectors"); i++ {
pi, err := sb.AddPiece(size, i, r, nil)
sid, err := sb.AcquireSectorId()
if err != nil {
return err
}
pi, err := sb.AddPiece(size, sid, r, nil)
if err != nil {
return err
}
@ -135,7 +140,7 @@ var preSealCmd = &cli.Command{
fmt.Println("Piece info: ", pi)
pco, err := sb.SealPreCommit(i, ticket, []sectorbuilder.PublicPieceInfo{pi})
pco, err := sb.SealPreCommit(sid, ticket, []sectorbuilder.PublicPieceInfo{pi})
if err != nil {
return xerrors.Errorf("commit: %w", err)
}
@ -143,7 +148,7 @@ var preSealCmd = &cli.Command{
sealedSectors = append(sealedSectors, genesis.PreSeal{
CommR: pco.CommR,
CommD: pco.CommD,
SectorID: i,
SectorID: sid,
})
}
@ -162,6 +167,10 @@ var preSealCmd = &cli.Command{
return err
}
if err := mds.Close(); err != nil {
return xerrors.Errorf("closing datastore: %w", err)
}
return nil
},
}

View File

@ -165,7 +165,7 @@ func migratePreSealedSectors(presealsb string, repoPath string, mds dtypes.Metad
srcds, err := badger.NewDatastore(filepath.Join(pspath, "badger"), nil)
if err != nil {
return err
return xerrors.Errorf("openning presealed sectors datastore: %w", err)
}
expRepo, err := homedir.Expand(repoPath)

View File

@ -70,7 +70,7 @@ func main() {
}
if err := app.Run(os.Args); err != nil {
log.Warn(err)
log.Warnf("%+v", err)
os.Exit(1)
}
}