fix: miner: init: only get sector-size once
This commit is contained in:
parent
39604faa09
commit
d8441b134a
@ -541,7 +541,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode
|
|||||||
|
|
||||||
addr = a
|
addr = a
|
||||||
} else {
|
} else {
|
||||||
a, err := createStorageMiner(ctx, api, peerid, gasPrice, cctx)
|
a, err := createStorageMiner(ctx, api, ssize, peerid, gasPrice, cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("creating miner failed: %w", err)
|
return xerrors.Errorf("creating miner failed: %w", err)
|
||||||
}
|
}
|
||||||
@ -621,7 +621,7 @@ func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address
|
|||||||
return nil
|
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 err error
|
||||||
var owner address.Address
|
var owner address.Address
|
||||||
if cctx.String("owner") != "" {
|
if cctx.String("owner") != "" {
|
||||||
@ -633,11 +633,6 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, peerid peer.ID,
|
|||||||
return address.Undef, err
|
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
|
worker := owner
|
||||||
if cctx.String("worker") != "" {
|
if cctx.String("worker") != "" {
|
||||||
worker, err = address.NewFromString(cctx.String("worker"))
|
worker, err = address.NewFromString(cctx.String("worker"))
|
||||||
@ -712,7 +707,7 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, peerid peer.ID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: the correct thing to do would be to call SealProofTypeFromSectorSize if actors version is v3 or later, but this still works
|
// Note: the correct thing to do would be to call SealProofTypeFromSectorSize if actors version is v3 or later, but this still works
|
||||||
spt, err := miner.WindowPoStProofTypeFromSectorSize(abi.SectorSize(ssize))
|
spt, err := miner.WindowPoStProofTypeFromSectorSize(ssize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, xerrors.Errorf("getting post proof type: %w", err)
|
return address.Undef, xerrors.Errorf("getting post proof type: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ OPTIONS:
|
|||||||
--create-worker-key create separate worker key (default: false)
|
--create-worker-key create separate worker key (default: false)
|
||||||
--worker value, -w value worker key to use (overrides --create-worker-key)
|
--worker value, -w value worker key to use (overrides --create-worker-key)
|
||||||
--owner value, -o value owner key to use
|
--owner value, -o value owner key to use
|
||||||
--sector-size value specify sector size to use (default: "2KiB")
|
--sector-size value specify sector size to use
|
||||||
--pre-sealed-sectors value specify set of presealed sectors for starting as a genesis miner (accepts multiple inputs)
|
--pre-sealed-sectors value specify set of presealed sectors for starting as a genesis miner (accepts multiple inputs)
|
||||||
--pre-sealed-metadata value specify the metadata file for the presealed sectors
|
--pre-sealed-metadata value specify the metadata file for the presealed sectors
|
||||||
--nosync don't check full-node sync status (default: false)
|
--nosync don't check full-node sync status (default: false)
|
||||||
|
Loading…
Reference in New Issue
Block a user