From d93e39098bd20e78802f062a44e1925caa7839bc Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 9 Jan 2025 15:41:25 -0300 Subject: [PATCH] derivekey: add test TestDeriveKeyXprv This test checks that "chantools derivekey --rootkey xpriv..." works. --- cmd/chantools/derivekey_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cmd/chantools/derivekey_test.go b/cmd/chantools/derivekey_test.go index e99a926..47ee731 100644 --- a/cmd/chantools/derivekey_test.go +++ b/cmd/chantools/derivekey_test.go @@ -82,3 +82,23 @@ func TestDeriveKeySeedBip39(t *testing.T) { h.assertLogContains(keyContentBIP39) } + +func TestDeriveKeyXprv(t *testing.T) { + h := newHarness(t) + + // Derive a specific key from xprv. + derive := &deriveKeyCommand{ + Path: testPath, + rootKey: &rootKey{ + RootKey: "xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nR" + + "k4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejM" + + "RNNU3TGtRBeJgk33yuGBxrMPHi", + }, + } + + err := derive.Execute(nil, nil) + require.NoError(t, err) + + h.assertLogContains("cQcdieZy2d1TAdCsa5MjmHJs2gdHcD7x22nDbhJyVTUa3Ax" + + "5KB3w") +}