Skip to content

Commit 6f0575c

Browse files
committed
refactor: use slices.Equal to simplify code
Signed-off-by: tzchenxixi <tzchenxixi@icloud.com>
1 parent bd814d5 commit 6f0575c

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

sdk/bip39.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"errors"
1616
"fmt"
1717
"math/big"
18+
"slices"
1819
"strings"
1920
"sync"
2021

@@ -360,15 +361,7 @@ func padByteSlice(slice []byte, length int) []byte {
360361
// compareByteSlices returns true of the byte slices have equal contents and
361362
// returns false otherwise.
362363
func compareByteSlices(a, b []byte) bool {
363-
if len(a) != len(b) {
364-
return false
365-
}
366-
for i := range a {
367-
if a[i] != b[i] {
368-
return false
369-
}
370-
}
371-
return true
364+
return slices.Equal(a, b)
372365
}
373366

374367
func splitMnemonicWords(mnemonic string) ([]string, bool) {

0 commit comments

Comments
 (0)