cli/wallet: save tx only if --out was provided

Also don't print tx hash twice.
This commit is contained in:
Evgenii Stratonikov 2020-10-02 09:40:41 +03:00
parent 0a596e1df2
commit d50a14359a

View file

@ -59,15 +59,17 @@ func signMultisig(ctx *cli.Context) error {
if !ok { if !ok {
return cli.NewExitError("verifiable item is not a transaction", 1) return cli.NewExitError("verifiable item is not a transaction", 1)
} }
fmt.Fprintln(ctx.App.Writer, tx.Hash().StringLE())
priv := acc.PrivateKey() priv := acc.PrivateKey()
sign := priv.Sign(tx.GetSignedPart()) sign := priv.Sign(tx.GetSignedPart())
if err := c.AddSignature(acc.Contract, priv.PublicKey(), sign); err != nil { if err := c.AddSignature(acc.Contract, priv.PublicKey(), sign); err != nil {
return cli.NewExitError(fmt.Errorf("can't add signature: %w", err), 1) return cli.NewExitError(fmt.Errorf("can't add signature: %w", err), 1)
} else if err := writeParameterContext(c, ctx.String("out")); err != nil { }
if out := ctx.String("out"); out != "" {
if err := writeParameterContext(c, out); err != nil {
return cli.NewExitError(err, 1) return cli.NewExitError(err, 1)
} }
}
if len(ctx.String(options.RPCEndpointFlag)) != 0 { if len(ctx.String(options.RPCEndpointFlag)) != 0 {
w, err := c.GetWitness(acc.Contract) w, err := c.GetWitness(acc.Contract)
if err != nil { if err != nil {