Merge PR #3698: Prompt User Confirmation Prior to Signing & Broadcasting

* Prompt user confirmation prior to sign & broadcasting
* Update confirmation message
* Update and fix existing CLI integration tests
* Implement CLI integration test for tx confirmation
* Fix order of input into tx send
This commit is contained in:
Alexander Bezobchuk
2019-02-26 12:34:01 +01:00
committed by Christopher Goes
parent 250dc9807b
commit feb98bcd05
8 changed files with 105 additions and 37 deletions
+16
View File
@@ -62,6 +62,22 @@ func CompleteAndBroadcastTxCLI(txBldr authtxb.TxBuilder, cliCtx context.CLIConte
return nil
}
if !cliCtx.SkipConfirm {
stdSignMsg, err := txBldr.BuildSignMsg(msgs)
if err != nil {
return err
}
fmt.Fprintf(os.Stderr, "%s\n\n", cliCtx.Codec.MustMarshalJSON(stdSignMsg))
buf := client.BufferStdin()
ok, err := client.GetConfirmation("confirm transaction before signing and broadcasting", buf)
if err != nil || !ok {
fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction")
return err
}
}
passphrase, err := keys.GetPassphrase(fromName)
if err != nil {
return err