From 5efbbc323759382649c547df756cd7a084f578cd Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 24 Oct 2017 22:15:04 +0200 Subject: [PATCH] One step for module eyes commands compiling --- modules/eyes/commands/query.go | 4 ++-- util/prefix.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 util/prefix.go diff --git a/modules/eyes/commands/query.go b/modules/eyes/commands/query.go index aa6865d923..171a7c72d0 100644 --- a/modules/eyes/commands/query.go +++ b/modules/eyes/commands/query.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/commands" "github.com/cosmos/cosmos-sdk/client/commands/query" "github.com/cosmos/cosmos-sdk/modules/eyes" - "github.com/cosmos/cosmos-sdk/stack" + "github.com/cosmos/cosmos-sdk/util" ) // EyesQueryCmd - command to query raw data @@ -33,7 +33,7 @@ func eyesQueryCmd(cmd *cobra.Command, args []string) error { return err } - key = stack.PrefixedKey(eyes.Name, key) + key = util.PrefixedKey(eyes.Name, key) prove := !viper.GetBool(commands.FlagTrustNode) height, err := query.GetParsed(key, &res, query.GetHeight(), prove) if err != nil { diff --git a/util/prefix.go b/util/prefix.go new file mode 100644 index 0000000000..d81e551225 --- /dev/null +++ b/util/prefix.go @@ -0,0 +1,10 @@ +package util + +// PrefixedKey returns the absolute path to a given key in a particular +// app's state-space +// +// This is useful for to set up queries for this particular app data +func PrefixedKey(app string, key []byte) []byte { + prefix := append([]byte(app), byte(0)) + return append(prefix, key...) +}