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...)
|
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
|
// 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
|
// extended key is a private extended key (as determined by the IsPrivate
|
||||||
// function), a private extended key will be derived. Otherwise, the derived
|
// 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
|
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 {
|
func (k *ExtendedKey) ChildIndex() uint32 {
|
||||||
return k.childNum
|
return k.childNum
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,10 +623,10 @@ func TestExtendedKeyAPI(t *testing.T) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
childNum := key.ChildNum()
|
childIndex := key.ChildIndex()
|
||||||
if childNum != test.childNum {
|
if childIndex != test.childNum {
|
||||||
t.Errorf("ChildNum #%d (%s): want %d, got %d", i,
|
t.Errorf("ChildIndex #%d (%s): want %d, got %d", i,
|
||||||
test.name, childNum, test.childNum)
|
test.name, test.childNum, childIndex)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue