@@ -14,17 +14,23 @@ import (
1414 "github.com/tyler-smith/go-bip39"
1515)
1616
17- // DefaultBaseDerivationPath is the base path from which custom derivation endpoints
18- // are incremented. As such, the first account will be at m/44'/60'/0'/0/0, the second
19- // at m/44'/60'/0'/0/1, etc.
20- var DefaultBaseDerivationPath = accounts .DefaultBaseDerivationPath
21-
2217// Entropy bit size constants for 12 and 24 word mnemonics
2318const (
2419 EntropyBitSize12WordMnemonic = 128
2520 EntropyBitSize24WordMnemonic = 256
2621)
2722
23+ // DefaultBaseDerivationPath is the base path from which custom derivation endpoints
24+ // are incremented. As such, the first account will be at m/44'/60'/0'/0/0, the second
25+ // at m/44'/60'/0'/0/1, etc.
26+ var defaultBaseDerivationPath = accounts .DefaultBaseDerivationPath
27+
28+ func DefaultBaseDerivationPath () accounts.DerivationPath {
29+ derivationPath := make (accounts.DerivationPath , len (defaultBaseDerivationPath ))
30+ copy (derivationPath , defaultBaseDerivationPath )
31+ return derivationPath
32+ }
33+
2834type HDNode struct {
2935 masterKey * hdkeychain.ExtendedKey
3036 privateKey * ecdsa.PrivateKey
@@ -82,7 +88,7 @@ func NewHDNodeFromEntropy(entropy []byte, path *accounts.DerivationPath) (*HDNod
8288
8389 var derivationPath accounts.DerivationPath
8490 if path == nil {
85- derivationPath = DefaultBaseDerivationPath
91+ derivationPath = DefaultBaseDerivationPath ()
8692 } else {
8793 derivationPath = * path
8894 }
0 commit comments