seed: Support parsing string sector-size

This commit is contained in:
Łukasz Magiera 2020-03-15 21:42:44 +01:00
parent 630df050c0
commit a71906525a

View File

@ -4,6 +4,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/docker/go-units"
"io/ioutil"
"os"
@ -62,9 +63,9 @@ var preSealCmd = &cli.Command{
Value: "t01000",
Usage: "specify the future address of your miner",
},
&cli.Uint64Flag{
&cli.StringFlag{
Name: "sector-size",
Value: uint64(build.SectorSizes[0]),
Value: "2KiB",
Usage: "specify size of sectors to pre-seal",
},
&cli.StringFlag{
@ -113,7 +114,13 @@ var preSealCmd = &cli.Command{
}
}
rp, _, err := lapi.ProofTypeFromSectorSize(abi.SectorSize(c.Uint64("sector-size")))
sectorSizeInt, err := units.RAMInBytes(c.String("sector-size"))
if err != nil {
return err
}
sectorSize := abi.SectorSize(sectorSizeInt)
rp, _, err := lapi.ProofTypeFromSectorSize(sectorSize)
if err != nil {
return err
}