Some safeguards on chain delete-obj
This commit is contained in:
parent
5e445f5a48
commit
6c5ed3f07f
16
cli/chain.go
16
cli/chain.go
@ -195,9 +195,15 @@ var chainReadObjCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var chainDeleteObjCmd = &cli.Command{
|
||||
Name: "delete-obj",
|
||||
Usage: "Delete an object",
|
||||
ArgsUsage: "[objectCid]",
|
||||
Name: "delete-obj",
|
||||
Usage: "Delete an object from the chain blockstore",
|
||||
Description: "WARNING: Removing wrong objects from the chain blockstore may lead to sync issues",
|
||||
ArgsUsage: "[objectCid]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "really-do-it",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
@ -211,6 +217,10 @@ var chainDeleteObjCmd = &cli.Command{
|
||||
return fmt.Errorf("failed to parse cid input: %s", err)
|
||||
}
|
||||
|
||||
if !cctx.Bool("really-do-it") {
|
||||
return xerrors.Errorf("pass the --really-do-it flag to proceed")
|
||||
}
|
||||
|
||||
err = api.ChainDeleteObj(ctx, c)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user