Skip to content

Commit d463e82

Browse files
committed
fix(params, address): Fix index allocation
Signed-off-by: Sophia Koehler <sophia@perun.network>
1 parent 2d98975 commit d463e82

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

channel/params.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ func IDKey(ids IDMap) string {
134134
}
135135

136136
func sortIDMap(ids IDMap) ([]wallet.BackendID, []ID) {
137-
indexes := make([]int, len(ids))
137+
var indexes []int //nolint:prealloc
138138
for i := range ids {
139-
indexes[i] = int(i)
139+
indexes = append(indexes, int(i))
140140
}
141141
sort.Ints(indexes)
142142
sortedIndexes := make([]wallet.BackendID, len(indexes))

wire/address.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ func Key(a Address) AddrKey {
178178

179179
// Keys returns the `AddrKey` corresponding to the passed `map[int]Address`.
180180
func Keys(addressMap map[wallet.BackendID]Address) AddrKey {
181-
indexes := make([]int, len(addressMap))
181+
var indexes []int //nolint:prealloc
182182
for i := range addressMap {
183-
indexes[i] = int(i)
183+
indexes = append(indexes, int(i))
184184
}
185185
sort.Ints(indexes)
186186

0 commit comments

Comments
 (0)