From 0c23dec59f76c2a60a3f7152afc0492343bad452 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 16 Apr 2019 13:02:36 -0400 Subject: [PATCH] Merge PR #4135: Minor Fixes * Add clarification to gen-only * Add nil type check in NewResponseFormatBroadcastTxCommit * Add small note to docs re: generate-only --- client/context/context.go | 4 +++- client/flags.go | 2 +- docs/cosmos-hub/gaiacli.md | 4 ++++ types/result.go | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/context/context.go b/client/context/context.go index e9d7e6782..ea87533ff 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -7,6 +7,8 @@ import ( "os" "path/filepath" + "github.com/pkg/errors" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/codec" @@ -292,7 +294,7 @@ func GetFromFields(from string, genOnly bool) (sdk.AccAddress, string, error) { if genOnly { addr, err := sdk.AccAddressFromBech32(from) if err != nil { - return nil, "", err + return nil, "", errors.Wrap(err, "must provide a valid Bech32 address for generate-only") } return addr, "", nil diff --git a/client/flags.go b/client/flags.go index 77aec7e24..26ff68e82 100644 --- a/client/flags.go +++ b/client/flags.go @@ -93,7 +93,7 @@ func PostCommands(cmds ...*cobra.Command) []*cobra.Command { c.Flags().Bool(FlagPrintResponse, true, "return tx response (only works with async = false)") c.Flags().Bool(FlagTrustNode, true, "Trust connected full node (don't verify proofs for responses)") c.Flags().Bool(FlagDryRun, false, "ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it") - c.Flags().Bool(FlagGenerateOnly, false, "build an unsigned transaction and write it to STDOUT") + c.Flags().Bool(FlagGenerateOnly, false, "Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)") c.Flags().BoolP(FlagSkipConfirmation, "y", false, "Skip tx broadcasting prompt confirmation") // --gas can accept integers and "simulate" diff --git a/docs/cosmos-hub/gaiacli.md b/docs/cosmos-hub/gaiacli.md index 509745551..4aa133ec8 100644 --- a/docs/cosmos-hub/gaiacli.md +++ b/docs/cosmos-hub/gaiacli.md @@ -242,6 +242,10 @@ gaiacli tx sign \ unsignedSendTx.json > signedSendTx.json ``` +::: tip Note +The `--generate-only` flag prevents `gaiacli` from accessing the local keybase. +::: + You can validate the transaction's signatures by typing the following: ```bash diff --git a/types/result.go b/types/result.go index e83ed56e1..7f0590241 100644 --- a/types/result.go +++ b/types/result.go @@ -107,6 +107,10 @@ func NewResponseResultTx(res *ctypes.ResultTx, tx Tx, timestamp string) TxRespon // NewResponseFormatBroadcastTxCommit returns a TxResponse given a // ResultBroadcastTxCommit from tendermint. func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) TxResponse { + if res == nil { + return TxResponse{} + } + if !res.CheckTx.IsOK() { return newTxResponseCheckTx(res) }