diff --git a/CHANGELOG.md b/CHANGELOG.md index 4520e5609c5d..9de380c2d43b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#9793](https://github.com/cosmos/cosmos-sdk/pull/9793) Fixed ECDSA/secp256r1 transaction malleability. +### CLI Breaking Changes + +* [\#9781](https://github.com/cosmos/cosmos-sdk/pull/9781) Improve`withdraw-all-rewards` UX when broadcast mode `async` or `async` is used. + ## [v0.43.0-rc2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.43.0-rc2) - 2021-07-19 ### Bug Fixes diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index f65e6fd8a75e..4808b50cc26a 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -23,7 +23,7 @@ var ( ) const ( - MaxMessagesPerTxDefault = 5 + MaxMessagesPerTxDefault = 0 ) // NewTxCmd returns a root CLI command handler for all x/distribution transaction commands. @@ -132,11 +132,12 @@ func NewWithdrawAllRewardsCmd() *cobra.Command { Short: "withdraw all delegations rewards for a delegator", Long: strings.TrimSpace( fmt.Sprintf(`Withdraw all rewards for a single delegator. +Note that if you use this command with --%[2]s=%[3]s or --%[2]s=%[4]s, the %[5]s flag will automatically be set to 0. Example: -$ %s tx distribution withdraw-all-rewards --from mykey +$ %[1]s tx distribution withdraw-all-rewards --from mykey `, - version.AppName, + version.AppName, flags.FlagBroadcastMode, flags.BroadcastSync, flags.BroadcastAsync, FlagMaxMessagesPerTx, ), ), Args: cobra.NoArgs, @@ -176,6 +177,11 @@ $ %s tx distribution withdraw-all-rewards --from mykey } chunkSize, _ := cmd.Flags().GetInt(FlagMaxMessagesPerTx) + if clientCtx.BroadcastMode != flags.BroadcastBlock && chunkSize > 0 { + return fmt.Errorf("cannot use broadcast mode %[1]s with %[2]s != 0", + clientCtx.BroadcastMode, FlagMaxMessagesPerTx) + } + return newSplitAndApply(tx.GenerateOrBroadcastTxCLI, clientCtx, cmd.Flags(), msgs, chunkSize) }, }