diff --git a/client/tx/tx.go b/client/tx/tx.go index 79ad9beae7..ca748fac6d 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -94,16 +94,19 @@ func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error { } if err := clientCtx.PrintRaw(json.RawMessage(txBytes)); err != nil { - _, _ = fmt.Fprintf(os.Stderr, "%s\n", txBytes) + _, _ = fmt.Fprintf(os.Stderr, "error: %v\n%s\n", err, txBytes) } buf := bufio.NewReader(os.Stdin) ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf, os.Stderr) - - if err != nil || !ok { - _, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction") + if err != nil { + _, _ = fmt.Fprintf(os.Stderr, "error: %v\ncancelled transaction\n", err) return err } + if !ok { + _, _ = fmt.Fprintln(os.Stderr, "cancelled transaction") + return nil + } } // When Textual is wired up, the context argument should be retrieved from the client context.