storageminer: Parse pretty sector sizes in init

This commit is contained in:
Łukasz Magiera 2020-04-01 23:53:13 +02:00
parent f727f1db26
commit fa86359549

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules"
"github.com/docker/go-units"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/crypto"
@ -75,10 +76,10 @@ var initCmd = &cli.Command{
Aliases: []string{"o"}, Aliases: []string{"o"},
Usage: "owner key to use", Usage: "owner key to use",
}, },
&cli.Uint64Flag{ &cli.StringFlag{
Name: "sector-size", Name: "sector-size",
Usage: "specify sector size to use", Usage: "specify sector size to use",
Value: uint64(build.SectorSizes[0]), Value: fmt.Sprint(build.SectorSizes[0]),
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "pre-sealed-sectors", Name: "pre-sealed-sectors",
@ -109,7 +110,11 @@ var initCmd = &cli.Command{
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
log.Info("Initializing lotus storage miner") log.Info("Initializing lotus storage miner")
ssize := abi.SectorSize(cctx.Uint64("sector-size")) sectorSizeInt, err := units.RAMInBytes(cctx.String("sector-size"))
if err != nil {
return err
}
ssize := abi.SectorSize(sectorSizeInt)
gasPrice, err := types.BigFromString(cctx.String("gas-price")) gasPrice, err := types.BigFromString(cctx.String("gas-price"))
if err != nil { if err != nil {