Skip to content

Commit 593f763

Browse files
committed
unit-test: stop using keystore_get_xpub
It is going away soon by being ported to Rust.
1 parent 3c1ec62 commit 593f763

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

test/unit-test/test_keystore_antiklepto.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ static void _test_keystore_antiklepto(void** state)
7272
host_nonce[0] = i;
7373
uint8_t host_nonce_commitment[32];
7474

75+
// Get pubkey at keypath
76+
struct ext_key xprv_master = {0};
77+
struct ext_key xprv_derived = {0};
78+
assert_int_equal(
79+
bip32_key_from_seed(
80+
_mock_bip39_seed, BIP32_ENTROPY_LEN_512, BIP32_VER_MAIN_PRIVATE, 0, &xprv_master),
81+
WALLY_OK);
82+
assert_int_equal(
83+
bip32_key_from_parent_path(
84+
&xprv_master, keypath, 5, BIP32_FLAG_KEY_PRIVATE, &xprv_derived),
85+
WALLY_OK);
86+
7587
// Protocol steps are described in secp256k1/include/secp256k1_ecdsa_s2c.h under "ECDSA
7688
// Anti-Klepto Protocol".
7789

@@ -90,11 +102,13 @@ static void _test_keystore_antiklepto(void** state)
90102
secp256k1_ecdsa_signature parsed_signature;
91103
assert_true(secp256k1_ecdsa_signature_parse_compact(
92104
wally_get_secp_context(), &parsed_signature, sig));
93-
struct ext_key xpub;
94-
assert_true(keystore_get_xpub(keypath, 5, &xpub));
105+
95106
secp256k1_pubkey parsed_pubkey;
96107
assert_true(secp256k1_ec_pubkey_parse(
97-
wally_get_secp_context(), &parsed_pubkey, xpub.pub_key, sizeof(xpub.pub_key)));
108+
wally_get_secp_context(),
109+
&parsed_pubkey,
110+
xprv_derived.pub_key,
111+
sizeof(xprv_derived.pub_key)));
98112
secp256k1_ecdsa_s2c_opening opening;
99113
assert_true(secp256k1_ecdsa_s2c_opening_parse(
100114
wally_get_secp_context(), &opening, signer_commitment));

0 commit comments

Comments
 (0)