Add storage-id flag to proving check
This commit is contained in:
parent
734a03cf82
commit
bfcfb199a0
@ -17,6 +17,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
)
|
||||
|
||||
@ -360,6 +361,10 @@ var provingCheckProvableCmd = &cli.Command{
|
||||
Name: "slow",
|
||||
Usage: "run slower checks",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-id",
|
||||
Usage: "filter sectors by storage path (path id)",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
@ -408,6 +413,21 @@ var provingCheckProvableCmd = &cli.Command{
|
||||
tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
||||
_, _ = fmt.Fprintln(tw, "deadline\tpartition\tsector\tstatus")
|
||||
|
||||
var filter map[abi.SectorID]struct{}
|
||||
|
||||
if cctx.IsSet("storage-id") {
|
||||
sl, err := sapi.StorageList(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
decls := sl[stores.ID(cctx.String("storage-id"))]
|
||||
|
||||
filter = map[abi.SectorID]struct{}{}
|
||||
for _, decl := range decls {
|
||||
filter[decl.SectorID] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
for parIdx, par := range partitions {
|
||||
sectors := make(map[abi.SectorNumber]struct{})
|
||||
|
||||
@ -418,13 +438,21 @@ var provingCheckProvableCmd = &cli.Command{
|
||||
|
||||
var tocheck []storage.SectorRef
|
||||
for _, info := range sectorInfos {
|
||||
si := abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: info.SectorNumber,
|
||||
}
|
||||
|
||||
if filter != nil {
|
||||
if _, found := filter[si]; !found {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
sectors[info.SectorNumber] = struct{}{}
|
||||
tocheck = append(tocheck, storage.SectorRef{
|
||||
ProofType: info.SealProof,
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: info.SectorNumber,
|
||||
},
|
||||
ID: si,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1901,6 +1901,7 @@ USAGE:
|
||||
OPTIONS:
|
||||
--only-bad print only bad sectors (default: false)
|
||||
--slow run slower checks (default: false)
|
||||
--storage-id value filter sectors by storage path (path id)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user