Skip to content

Commit

Permalink
fix: miner: init: only get sector-size once
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Sep 23, 2022
1 parent 971cdf5 commit dbc4327
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions cmd/lotus-miner/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode

addr = a
} else {
a, err := createStorageMiner(ctx, api, peerid, gasPrice, cctx)
a, err := createStorageMiner(ctx, api, ssize, peerid, gasPrice, cctx)
if err != nil {
return xerrors.Errorf("creating miner failed: %w", err)
}
Expand Down Expand Up @@ -627,7 +627,7 @@ func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address
return nil
}

func createStorageMiner(ctx context.Context, api v1api.FullNode, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) {
func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.SectorSize, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) {
var err error
var owner address.Address
if cctx.String("owner") != "" {
Expand All @@ -639,11 +639,6 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, peerid peer.ID,
return address.Undef, err
}

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") != "" {
worker, err = address.NewFromString(cctx.String("worker"))
Expand Down

0 comments on commit dbc4327

Please sign in to comment.