Add flag for cli slash-consensus
This commit is contained in:
parent
d5dae844bd
commit
41066bd45e
31
cli/chain.go
31
cli/chain.go
@ -835,6 +835,10 @@ var slashConsensusFault = &cli.Command{
|
|||||||
Name: "miner",
|
Name: "miner",
|
||||||
Usage: "Miner address",
|
Usage: "Miner address",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "extra",
|
||||||
|
Usage: "Extra block cid",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api, closer, err := GetFullNodeAPI(cctx)
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
@ -879,10 +883,31 @@ var slashConsensusFault = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
params, err := actors.SerializeParams(&miner.ReportConsensusFaultParams{
|
params := miner.ReportConsensusFaultParams{
|
||||||
BlockHeader1: bh1,
|
BlockHeader1: bh1,
|
||||||
BlockHeader2: bh2,
|
BlockHeader2: bh2,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if cctx.String("extra") != "" {
|
||||||
|
cExtra, err := cid.Parse(cctx.String("extra"))
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("parsing cid extra: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
bExtra, err := api.ChainGetBlock(ctx, cExtra)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("getting block extra: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
be, err := cborutil.Dump(bExtra)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
params.BlockHeaderExtra = be
|
||||||
|
}
|
||||||
|
|
||||||
|
enc, err := actors.SerializeParams(¶ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -903,7 +928,7 @@ var slashConsensusFault = &cli.Command{
|
|||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: 10000000,
|
GasLimit: 10000000,
|
||||||
Method: builtin.MethodsMiner.ReportConsensusFault,
|
Method: builtin.MethodsMiner.ReportConsensusFault,
|
||||||
Params: params,
|
Params: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
smsg, err := api.MpoolPushMessage(ctx, msg)
|
smsg, err := api.MpoolPushMessage(ctx, msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user