cli/contract: make --force flag bool

This commit is contained in:
Evgenii Stratonikov 2020-12-04 10:59:46 +03:00
parent 8be9158e2f
commit d71e45bcc5

View file

@ -56,7 +56,7 @@ var (
Name: "out",
Usage: "file to put JSON transaction to",
}
forceFlag = cli.StringFlag{
forceFlag = cli.BoolFlag{
Name: "force",
Usage: "force-push the transaction in case of bad VM state after test script invocation",
}
@ -507,7 +507,7 @@ func invokeInternal(ctx *cli.Context, signAndPush bool) error {
}
if signAndPush && resp.State != "HALT" {
errText := fmt.Sprintf("Warning: %s VM state returned from the RPC node: %s\n", resp.State, resp.FaultException)
if ctx.String("force") == "" {
if !ctx.Bool("force") {
return cli.NewExitError(errText+". Use --force flag to send the transaction anyway.", 1)
}
fmt.Fprintln(ctx.App.Writer, errText+". Sending transaction...")