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.
|
||||
|
||||
// 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,
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -1475,7 +1475,7 @@ func deriveCoinTypeKey(masterNode *hdkeychain.ExtendedKey,
|
|||
}
|
||||
|
||||
// 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,
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -1501,7 +1501,7 @@ func deriveAccountKey(coinTypeKey *hdkeychain.ExtendedKey,
|
|||
}
|
||||
|
||||
// Derive the account key as a child of the coin type key.
|
||||
return coinTypeKey.DeriveNonStandard( // nolint:staticcheck
|
||||
return coinTypeKey.Derive(
|
||||
account + hdkeychain.HardenedKeyStart,
|
||||
)
|
||||
}
|
||||
|
@ -1519,12 +1519,12 @@ func deriveAccountKey(coinTypeKey *hdkeychain.ExtendedKey,
|
|||
// The branch is 0 for external addresses and 1 for internal addresses.
|
||||
func checkBranchKeys(acctKey *hdkeychain.ExtendedKey) error {
|
||||
// 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
|
||||
}
|
||||
|
||||
// Derive the internal branch as the second child of the account key.
|
||||
_, err := acctKey.DeriveNonStandard(InternalBranch) // nolint:staticcheck
|
||||
_, err := acctKey.Derive(InternalBranch)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -345,14 +345,14 @@ func (s *ScopedKeyManager) deriveKey(acctInfo *accountInfo, branch,
|
|||
}
|
||||
|
||||
// Derive and return the key.
|
||||
branchKey, err := acctKey.DeriveNonStandard(branch) // nolint:staticcheck
|
||||
branchKey, err := acctKey.Derive(branch)
|
||||
if err != nil {
|
||||
str := fmt.Sprintf("failed to derive extended key branch %d",
|
||||
branch)
|
||||
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.
|
||||
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.
|
||||
branchKey, err := acctKey.DeriveNonStandard(branchNum) // nolint:staticcheck
|
||||
branchKey, err := acctKey.Derive(branchNum)
|
||||
if err != nil {
|
||||
str := fmt.Sprintf("failed to derive extended key branch %d",
|
||||
branchNum)
|
||||
|
@ -1030,7 +1030,7 @@ func (s *ScopedKeyManager) nextAddresses(ns walletdb.ReadWriteBucket,
|
|||
var nextKey *hdkeychain.ExtendedKey
|
||||
for {
|
||||
// Derive the next child in the external chain branch.
|
||||
key, err := branchKey.DeriveNonStandard(nextIndex) // nolint:staticcheck
|
||||
key, err := branchKey.Derive(nextIndex)
|
||||
if err != nil {
|
||||
// When this particular child is invalid, skip to the
|
||||
// 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.
|
||||
branchKey, err := acctKey.DeriveNonStandard(branchNum) // nolint:staticcheck
|
||||
branchKey, err := acctKey.Derive(branchNum)
|
||||
if err != nil {
|
||||
str := fmt.Sprintf("failed to derive extended key branch %d",
|
||||
branchNum)
|
||||
|
@ -1234,7 +1234,7 @@ func (s *ScopedKeyManager) extendAddresses(ns walletdb.ReadWriteBucket,
|
|||
var nextKey *hdkeychain.ExtendedKey
|
||||
for {
|
||||
// Derive the next child in the external chain branch.
|
||||
key, err := branchKey.DeriveNonStandard(nextIndex) // nolint:staticcheck
|
||||
key, err := branchKey.Derive(nextIndex)
|
||||
if err != nil {
|
||||
// When this particular child is invalid, skip to the
|
||||
// next index.
|
||||
|
|
Loading…
Reference in a new issue