Skip to content

Commit 0310e8c

Browse files
committed
Merge branch 'keystore-xpub'
2 parents 0608d7d + 041e2b8 commit 0310e8c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/keystore.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -574,14 +574,11 @@ bool keystore_secp256k1_pubkey_hash160(
574574
size_t keypath_len,
575575
uint8_t* hash160_out)
576576
{
577-
if (keystore_is_locked()) {
578-
return false;
579-
}
580-
struct ext_key xprv __attribute__((__cleanup__(keystore_zero_xkey))) = {0};
581-
if (!_get_xprv_twice(keypath, keypath_len, &xprv)) {
577+
struct ext_key xpub __attribute__((__cleanup__(keystore_zero_xkey))) = {0};
578+
if (!keystore_get_xpub(keypath, keypath_len, &xpub)) {
582579
return false;
583580
}
584-
memcpy(hash160_out, xprv.hash160, sizeof(xprv.hash160));
581+
memcpy(hash160_out, xpub.hash160, sizeof(xpub.hash160));
585582
return true;
586583
}
587584

@@ -590,14 +587,11 @@ bool keystore_secp256k1_pubkey_uncompressed(
590587
size_t keypath_len,
591588
uint8_t* pubkey_out)
592589
{
593-
if (keystore_is_locked()) {
594-
return false;
595-
}
596-
struct ext_key xprv __attribute__((__cleanup__(keystore_zero_xkey))) = {0};
597-
if (!_get_xprv_twice(keypath, keypath_len, &xprv)) {
590+
struct ext_key xpub __attribute__((__cleanup__(keystore_zero_xkey))) = {0};
591+
if (!keystore_get_xpub(keypath, keypath_len, &xpub)) {
598592
return false;
599593
}
600-
return _compressed_to_uncompressed(xprv.pub_key, pubkey_out);
594+
return _compressed_to_uncompressed(xpub.pub_key, pubkey_out);
601595
}
602596

603597
bool keystore_secp256k1_nonce_commit(

0 commit comments

Comments
 (0)