waddrmgr: use Derive() instead of DeriveNonStandard()
This commit is contained in:
parent
1f05a9858b
commit
10470208fb
2 changed files with 11 additions and 11 deletions
|
@ -1467,7 +1467,7 @@ func deriveCoinTypeKey(masterNode *hdkeychain.ExtendedKey,
|
||||||
// The branch is 0 for external addresses and 1 for internal addresses.
|
// The branch is 0 for external addresses and 1 for internal addresses.
|
||||||
|
|
||||||
// Derive the purpose key as a child of the master node.
|
// Derive the purpose key as a child of the master node.
|
||||||
purpose, err := masterNode.DeriveNonStandard( // nolint:staticcheck
|
purpose, err := masterNode.Derive(
|
||||||
scope.Purpose + hdkeychain.HardenedKeyStart,
|
scope.Purpose + hdkeychain.HardenedKeyStart,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1475,7 +1475,7 @@ func deriveCoinTypeKey(masterNode *hdkeychain.ExtendedKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive the coin type key as a child of the purpose key.
|
// Derive the coin type key as a child of the purpose key.
|
||||||
coinTypeKey, err := purpose.DeriveNonStandard( // nolint:staticcheck
|
coinTypeKey, err := purpose.Derive(
|
||||||
scope.Coin + hdkeychain.HardenedKeyStart,
|
scope.Coin + hdkeychain.HardenedKeyStart,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1501,7 +1501,7 @@ func deriveAccountKey(coinTypeKey *hdkeychain.ExtendedKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive the account key as a child of the coin type key.
|
// Derive the account key as a child of the coin type key.
|
||||||
return coinTypeKey.DeriveNonStandard( // nolint:staticcheck
|
return coinTypeKey.Derive(
|
||||||
account + hdkeychain.HardenedKeyStart,
|
account + hdkeychain.HardenedKeyStart,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1519,12 +1519,12 @@ func deriveAccountKey(coinTypeKey *hdkeychain.ExtendedKey,
|
||||||
// The branch is 0 for external addresses and 1 for internal addresses.
|
// The branch is 0 for external addresses and 1 for internal addresses.
|
||||||
func checkBranchKeys(acctKey *hdkeychain.ExtendedKey) error {
|
func checkBranchKeys(acctKey *hdkeychain.ExtendedKey) error {
|
||||||
// Derive the external branch as the first child of the account key.
|
// Derive the external branch as the first child of the account key.
|
||||||
if _, err := acctKey.DeriveNonStandard(ExternalBranch); err != nil { // nolint:staticcheck
|
if _, err := acctKey.Derive(ExternalBranch); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive the internal branch as the second child of the account key.
|
// Derive the internal branch as the second child of the account key.
|
||||||
_, err := acctKey.DeriveNonStandard(InternalBranch) // nolint:staticcheck
|
_, err := acctKey.Derive(InternalBranch)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,14 +345,14 @@ func (s *ScopedKeyManager) deriveKey(acctInfo *accountInfo, branch,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive and return the key.
|
// Derive and return the key.
|
||||||
branchKey, err := acctKey.DeriveNonStandard(branch) // nolint:staticcheck
|
branchKey, err := acctKey.Derive(branch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := fmt.Sprintf("failed to derive extended key branch %d",
|
str := fmt.Sprintf("failed to derive extended key branch %d",
|
||||||
branch)
|
branch)
|
||||||
return nil, managerError(ErrKeyChain, str, err)
|
return nil, managerError(ErrKeyChain, str, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
addressKey, err := branchKey.DeriveNonStandard(index) // nolint:staticcheck
|
addressKey, err := branchKey.Derive(index)
|
||||||
|
|
||||||
// Zero branch key after it's used.
|
// Zero branch key after it's used.
|
||||||
branchKey.Zero()
|
branchKey.Zero()
|
||||||
|
@ -1013,7 +1013,7 @@ func (s *ScopedKeyManager) nextAddresses(ns walletdb.ReadWriteBucket,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive the appropriate branch key and ensure it is zeroed when done.
|
// Derive the appropriate branch key and ensure it is zeroed when done.
|
||||||
branchKey, err := acctKey.DeriveNonStandard(branchNum) // nolint:staticcheck
|
branchKey, err := acctKey.Derive(branchNum)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := fmt.Sprintf("failed to derive extended key branch %d",
|
str := fmt.Sprintf("failed to derive extended key branch %d",
|
||||||
branchNum)
|
branchNum)
|
||||||
|
@ -1030,7 +1030,7 @@ func (s *ScopedKeyManager) nextAddresses(ns walletdb.ReadWriteBucket,
|
||||||
var nextKey *hdkeychain.ExtendedKey
|
var nextKey *hdkeychain.ExtendedKey
|
||||||
for {
|
for {
|
||||||
// Derive the next child in the external chain branch.
|
// Derive the next child in the external chain branch.
|
||||||
key, err := branchKey.DeriveNonStandard(nextIndex) // nolint:staticcheck
|
key, err := branchKey.Derive(nextIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// When this particular child is invalid, skip to the
|
// When this particular child is invalid, skip to the
|
||||||
// next index.
|
// next index.
|
||||||
|
@ -1215,7 +1215,7 @@ func (s *ScopedKeyManager) extendAddresses(ns walletdb.ReadWriteBucket,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive the appropriate branch key and ensure it is zeroed when done.
|
// Derive the appropriate branch key and ensure it is zeroed when done.
|
||||||
branchKey, err := acctKey.DeriveNonStandard(branchNum) // nolint:staticcheck
|
branchKey, err := acctKey.Derive(branchNum)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := fmt.Sprintf("failed to derive extended key branch %d",
|
str := fmt.Sprintf("failed to derive extended key branch %d",
|
||||||
branchNum)
|
branchNum)
|
||||||
|
@ -1234,7 +1234,7 @@ func (s *ScopedKeyManager) extendAddresses(ns walletdb.ReadWriteBucket,
|
||||||
var nextKey *hdkeychain.ExtendedKey
|
var nextKey *hdkeychain.ExtendedKey
|
||||||
for {
|
for {
|
||||||
// Derive the next child in the external chain branch.
|
// Derive the next child in the external chain branch.
|
||||||
key, err := branchKey.DeriveNonStandard(nextIndex) // nolint:staticcheck
|
key, err := branchKey.Derive(nextIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// When this particular child is invalid, skip to the
|
// When this particular child is invalid, skip to the
|
||||||
// next index.
|
// next index.
|
||||||
|
|
Loading…
Reference in a new issue