From cb89c3ccbd81b93b9e59a980302e6375994225b6 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Wed, 29 May 2024 22:33:09 +0100 Subject: [PATCH] fix(wallet): compare x_only_pubkey when checking if wallet can unlock p2pk --- crates/cdk/src/wallet.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/cdk/src/wallet.rs b/crates/cdk/src/wallet.rs index b1a637d1..fa46e01e 100644 --- a/crates/cdk/src/wallet.rs +++ b/crates/cdk/src/wallet.rs @@ -1336,7 +1336,7 @@ impl Wallet { let pubkey_secret_key = match &signing_keys { Some(signing_keys) => signing_keys .iter() - .map(|s| (s.public_key().to_string(), s)) + .map(|s| (s.public_key().x_only_public_key(), s)) .collect(), None => HashMap::new(), }; @@ -1385,7 +1385,9 @@ impl Wallet { } } for pubkey in pubkeys { - if let Some(signing) = pubkey_secret_key.get(&pubkey.to_string()) { + if let Some(signing) = + pubkey_secret_key.get(&pubkey.x_only_public_key()) + { proof.sign_p2pk(signing.to_owned().clone())?; } }