Skip to content

Commit 5f7ade9

Browse files
committed
test: remove _test_keystore_get_xpub
Already covered by `bitbox02_rust::keystore::tests::test_get_xpub`.
1 parent a5c0a6b commit 5f7ade9

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

test/unit-test/test_keystore.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -174,38 +174,6 @@ static bool _pubkeys_equal(
174174
return memcmp(pubkey1_bytes, pubkey2_bytes, len) == 0;
175175
}
176176

177-
static void _test_keystore_get_xpub(void** state)
178-
{
179-
const secp256k1_context* ctx = wally_get_secp_context();
180-
181-
struct ext_key xpub = {0};
182-
183-
_mock_unlocked(NULL, 0, NULL);
184-
// fails because keystore is locked
185-
assert_false(keystore_get_xpub(_keypath, sizeof(_keypath) / sizeof(uint32_t), &xpub));
186-
187-
_mock_unlocked(_mock_seed, sizeof(_mock_seed), _mock_bip39_seed);
188-
assert_true(keystore_get_xpub(_keypath, sizeof(_keypath) / sizeof(uint32_t), &xpub));
189-
190-
secp256k1_pubkey expected_pubkey;
191-
assert_true(secp256k1_ec_pubkey_create(ctx, &expected_pubkey, _expected_seckey));
192-
193-
secp256k1_pubkey pubkey;
194-
assert_true(secp256k1_ec_pubkey_parse(ctx, &pubkey, xpub.pub_key, sizeof(xpub.pub_key)));
195-
196-
assert_true(_pubkeys_equal(ctx, &pubkey, &expected_pubkey));
197-
198-
char* xpub_string;
199-
// Make sure it's a public key, no
200-
assert_false(bip32_key_to_base58(&xpub, BIP32_FLAG_KEY_PRIVATE, &xpub_string) == WALLY_OK);
201-
assert_true(bip32_key_to_base58(&xpub, BIP32_FLAG_KEY_PUBLIC, &xpub_string) == WALLY_OK);
202-
assert_string_equal(
203-
xpub_string,
204-
"xpub6Gmp9vKrJrVbU5JDcPRm6UmJPjTBurWfqow6w3BoK46E6mVyScMfTXd66WFeLfRa7Ug4iGMWDpWLpZAYcuUHyz"
205-
"cWZCqh8393rbuMoerRK1p");
206-
wally_free_string(xpub_string);
207-
}
208-
209177
static void _test_keystore_secp256k1_nonce_commit(void** state)
210178
{
211179
uint8_t msg[32] = {0};
@@ -603,7 +571,6 @@ int main(void)
603571
mock_memory_set_salt_root(_salt_root);
604572

605573
const struct CMUnitTest tests[] = {
606-
cmocka_unit_test(_test_keystore_get_xpub),
607574
cmocka_unit_test(_test_keystore_secp256k1_nonce_commit),
608575
cmocka_unit_test(_test_keystore_secp256k1_sign),
609576
cmocka_unit_test(_test_keystore_encrypt_and_store_seed),

0 commit comments

Comments
 (0)