-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit bf12ce3) Co-authored-by: Damian Nolan <damiannolan@gmail.com>
- Loading branch information
1 parent
7dd842b
commit 884f007
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
"github.com/cosmos/cosmos-sdk/version" | ||
|
||
"github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" | ||
) | ||
|
||
// NewPruneAcknowledgementsTxCmd returns the command to create a new MsgPruneAcknowledgements transaction | ||
func NewPruneAcknowledgementsTxCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "prune-acknowledgements [port] [channel] [limit]", | ||
Short: "Prune expired packet acknowledgements stored in IBC state", | ||
Long: `Prune expired packet acknowledgements and receipts stored in IBC state. Packet ackwnowledgements and | ||
receipts are considered expired if a channel has been upgraded.`, | ||
Example: fmt.Sprintf("%s tx ibc prune-acknowledgements [port] [channel] [limit]", version.AppName), | ||
Args: cobra.ExactArgs(3), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
portID, channelID := args[0], args[1] | ||
limit, err := strconv.ParseUint(args[2], 10, 64) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
signer := clientCtx.GetFromAddress().String() | ||
msg := types.NewMsgPruneAcknowledgements(portID, channelID, limit, signer) | ||
|
||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
flags.AddTxFlagsToCmd(cmd) | ||
return cmd | ||
} |