Skip to content

Commit

Permalink
fix: don't use manual key prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
JimLarson committed Oct 3, 2021
1 parent 8af3e15 commit 50a881b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions golang/cosmos/x/lien/types/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ const (
StoreKey = ModuleName
)

var (
LienByAddressPrefix = []byte{0x01}
)

// The lien-by-address space maps prefixed addresses to Lien messages.
// The keys are raw address bytes with the appropriate prefix.
// The lien-by-address space maps addresses to Lien messages.
// The keys are raw address bytes.
// THe data are protobuf-encoded Lien messages.

// LienByAddressKey returns the lien lookup key for the addr.
func LienByAddressKey(addr sdk.AccAddress) []byte {
return append(LienByAddressPrefix, addr.Bytes()...)
return addr.Bytes()
}

// LienByAddressDecodeKey returns the address for the lien lookup key.
func LienByAddressDecodeKey(key []byte) sdk.AccAddress {
return sdk.AccAddress(key[len(LienByAddressPrefix):])
return sdk.AccAddress(key)
}

0 comments on commit 50a881b

Please sign in to comment.