Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
affanv14 committed Mar 22, 2024
1 parent 9f76806 commit d76e666
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions protocol/x/ratelimit/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ func GetPendingSendPacketKey(channelId string, sequenceNumber uint64) []byte {
return []byte(fmt.Sprintf("%s_%d", channelId, sequenceNumber))
}

func SplitPendingSendPacketKey(key []byte) (channelId string, sequenceNumber uint64, err error) {
err = nil
func SplitPendingSendPacketKey(key []byte) (string, uint64, error) {
err := error(nil)
parts := bytes.Split(key, []byte("_"))
if len(parts) != 2 {
err = fmt.Errorf("unexpected PendingSendPacket key format: %s", key)
return
return "", 0, err
}
channelId = string(parts[0])
// convert parts[1] to uint64 parts[1] is is a byte array with numeric characters of variable length
channelId := string(parts[0])

// convert parts[1] to uint64 parts[1] is a byte array with numeric characters of variable length
sequenceNumberInt, _ := strconv.Atoi(string(parts[1]))
sequenceNumber = uint64(sequenceNumberInt)
return
sequenceNumber := uint64(sequenceNumberInt)
return channelId, sequenceNumber, err
}

0 comments on commit d76e666

Please sign in to comment.