Skip to content

Commit 2c87545

Browse files
committed
Merge commit 'refs/pull/3322/head' of https://github.com/BitBoxSwiss/bitbox-wallet-app
2 parents 6710f46 + 709476d commit 2c87545

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

backend/signing/keypath.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package signing
1717
import (
1818
"encoding/json"
1919
"fmt"
20+
"slices"
2021
"strconv"
2122
"strings"
2223

@@ -133,7 +134,7 @@ func (relativeKeypath RelativeKeypath) Encode() string {
133134

134135
// Child appends the given node to this relative keypath.
135136
func (relativeKeypath RelativeKeypath) Child(index uint32, hardened bool) RelativeKeypath {
136-
newKeypath := append(RelativeKeypath{}, relativeKeypath...)
137+
newKeypath := slices.Clone(relativeKeypath)
137138
return append(newKeypath, keyNode{index, hardened})
138139
}
139140

@@ -202,13 +203,13 @@ func (absoluteKeypath AbsoluteKeypath) Encode() string {
202203

203204
// Child appends the given node to this absolute keypath.
204205
func (absoluteKeypath AbsoluteKeypath) Child(index uint32, hardened bool) AbsoluteKeypath {
205-
newKeypath := append(AbsoluteKeypath{}, absoluteKeypath...)
206+
newKeypath := slices.Clone(absoluteKeypath)
206207
return append(newKeypath, keyNode{index, hardened})
207208
}
208209

209210
// Append appends a relative keypath to this absolute keypath.
210211
func (absoluteKeypath AbsoluteKeypath) Append(suffix RelativeKeypath) AbsoluteKeypath {
211-
newKeypath := append(AbsoluteKeypath{}, absoluteKeypath...)
212+
newKeypath := slices.Clone(absoluteKeypath)
212213
return append(newKeypath, suffix...)
213214
}
214215

0 commit comments

Comments
 (0)