Skip to content

Commit

Permalink
fix(params, address): Fix index allocation
Browse files Browse the repository at this point in the history
Signed-off-by: Sophia Koehler <[email protected]>
  • Loading branch information
sophia1ch committed Dec 23, 2024
1 parent 2d98975 commit d463e82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions channel/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ func IDKey(ids IDMap) string {
}

func sortIDMap(ids IDMap) ([]wallet.BackendID, []ID) {
indexes := make([]int, len(ids))
var indexes []int //nolint:prealloc
for i := range ids {
indexes[i] = int(i)
indexes = append(indexes, int(i))
}
sort.Ints(indexes)
sortedIndexes := make([]wallet.BackendID, len(indexes))
Expand Down
4 changes: 2 additions & 2 deletions wire/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ func Key(a Address) AddrKey {

// Keys returns the `AddrKey` corresponding to the passed `map[int]Address`.
func Keys(addressMap map[wallet.BackendID]Address) AddrKey {
indexes := make([]int, len(addressMap))
var indexes []int //nolint:prealloc
for i := range addressMap {
indexes[i] = int(i)
indexes = append(indexes, int(i))
}
sort.Ints(indexes)

Expand Down

0 comments on commit d463e82

Please sign in to comment.