Skip to content

Commit d93e390

Browse files
committed
derivekey: add test TestDeriveKeyXprv
This test checks that "chantools derivekey --rootkey xpriv..." works.
1 parent b352ed9 commit d93e390

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cmd/chantools/derivekey_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,23 @@ func TestDeriveKeySeedBip39(t *testing.T) {
8282

8383
h.assertLogContains(keyContentBIP39)
8484
}
85+
86+
func TestDeriveKeyXprv(t *testing.T) {
87+
h := newHarness(t)
88+
89+
// Derive a specific key from xprv.
90+
derive := &deriveKeyCommand{
91+
Path: testPath,
92+
rootKey: &rootKey{
93+
RootKey: "xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nR" +
94+
"k4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejM" +
95+
"RNNU3TGtRBeJgk33yuGBxrMPHi",
96+
},
97+
}
98+
99+
err := derive.Execute(nil, nil)
100+
require.NoError(t, err)
101+
102+
h.assertLogContains("cQcdieZy2d1TAdCsa5MjmHJs2gdHcD7x22nDbhJyVTUa3Ax" +
103+
"5KB3w")
104+
}

0 commit comments

Comments
 (0)