Skip to content

Commit

Permalink
Minor change to hd method test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Oct 1, 2020
1 parent 3ac488e commit a69b919
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions hd_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,6 @@ func TestGetPrivateKeyByPath(t *testing.T) {
t.Fatalf("error occurred: %s", err.Error())
}

// Max depth key
var maxKey *hdkeychain.ExtendedKey
maxKey, err = GetHDKeyByPath(validKey, 1<<9, 1<<9)
if err != nil {
t.Fatalf("error occurred: %s", err.Error())
}

// Test depth limit
for i := 0; i < 1<<8-1; i++ {
maxKey, err = GetHDKeyByPath(maxKey, uint32(i), uint32(i))
if err != nil {
t.Log("hit the depth limit on HD key")
break
}
}

// Create the list of tests
var tests = []struct {
inputHDKey *hdkeychain.ExtendedKey
Expand Down Expand Up @@ -240,11 +224,11 @@ func TestGetHDKeyByPath(t *testing.T) {
}

// Test depth limit
// todo: make a better test (after 126 maxKey is now nil)
for i := 0; i < 1<<8-1; i++ {
maxKey, err = GetHDKeyByPath(maxKey, uint32(i), uint32(i))
if err != nil {
t.Log("hit the depth limit on HD key")
break
if i >= 126 && err == nil {
t.Fatalf("expected to hit depth limit on HD key index: %d", i)
}
}

Expand Down

0 comments on commit a69b919

Please sign in to comment.