Merge pull request #1727 from filecoin-project/fix/init-sector-size

properly handle parsing of miner init sector sizes
This commit is contained in:
Łukasz Magiera 2020-05-14 12:37:47 +02:00 committed by GitHub
commit d009b70171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,7 @@ func DefaultSectorSize() abi.SectorSize {
}
sort.Slice(szs, func(i, j int) bool {
return szs[i] < szs[i]
return szs[i] < szs[j]
})
return szs[0]

View File

@ -79,7 +79,7 @@ var initCmd = &cli.Command{
&cli.StringFlag{
Name: "sector-size",
Usage: "specify sector size to use",
Value: fmt.Sprint(build.DefaultSectorSize()),
Value: units.BytesSize(float64(build.DefaultSectorSize())),
},
&cli.StringSliceFlag{
Name: "pre-sealed-sectors",
@ -603,7 +603,10 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
return address.Undef, err
}
ssize := cctx.Uint64("sector-size")
ssize, err := units.RAMInBytes(cctx.String("sector-size"))
if err != nil {
return address.Undef, fmt.Errorf("failed to parse sector size: %w", err)
}
worker := owner
if cctx.String("worker") != "" {