hdkeychain: Remove duplicate ChildNum() method
This commit is contained in:
parent
5fadf96a72
commit
6c6f3fd3b7
2 changed files with 8 additions and 13 deletions
|
@ -198,14 +198,6 @@ func (k *ExtendedKey) ChainCode() []byte {
|
|||
return append([]byte{}, k.chainCode...)
|
||||
}
|
||||
|
||||
// ChildNum returns the index at which the child extended key was derived.
|
||||
//
|
||||
// Extended keys with ChildNum value between 0 and 2^31-1 are normal child
|
||||
// keys, and those with a value between 2^31 and 2^32-1 are hardened keys.
|
||||
func (k *ExtendedKey) ChildNum() uint32 {
|
||||
return k.childNum
|
||||
}
|
||||
|
||||
// Child returns a derived child extended key at the given index. When this
|
||||
// extended key is a private extended key (as determined by the IsPrivate
|
||||
// function), a private extended key will be derived. Otherwise, the derived
|
||||
|
@ -350,7 +342,10 @@ func (k *ExtendedKey) Child(i uint32) (*ExtendedKey, error) {
|
|||
k.depth+1, i, isPrivate), nil
|
||||
}
|
||||
|
||||
// ChildIndex returns the child index used to derive the extended key.
|
||||
// ChildNum returns the index at which the child extended key was derived.
|
||||
//
|
||||
// Extended keys with ChildNum value between 0 and 2^31-1 are normal child
|
||||
// keys, and those with a value between 2^31 and 2^32-1 are hardened keys.
|
||||
func (k *ExtendedKey) ChildIndex() uint32 {
|
||||
return k.childNum
|
||||
}
|
||||
|
|
|
@ -623,10 +623,10 @@ func TestExtendedKeyAPI(t *testing.T) {
|
|||
continue
|
||||
}
|
||||
|
||||
childNum := key.ChildNum()
|
||||
if childNum != test.childNum {
|
||||
t.Errorf("ChildNum #%d (%s): want %d, got %d", i,
|
||||
test.name, childNum, test.childNum)
|
||||
childIndex := key.ChildIndex()
|
||||
if childIndex != test.childNum {
|
||||
t.Errorf("ChildIndex #%d (%s): want %d, got %d", i,
|
||||
test.name, test.childNum, childIndex)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue