What changed, and why it matters
This commit is a routine API cleanup: it renames a method from `into_inner()` to `to_inner()` on a public-key wrapper type and keeps the old name as a deprecated alias. There is no security bug, no behavior change, and no vulnerability introduced or fixed.
No security action needed. Users may migrate from `into_inner()` to `to_inner()` before the deprecated alias is removed in a future release.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch renames XOnlyPublicKey::into_inner to to_inner to follow the Rust API naming convention for owned-to-owned conversions on Copy types. The old into_inner method is preserved with #[deprecated] and delegates to the new name. Tests and comments are updated accordingly. The implementation remains identical (self.0).
Changed components
bitcoin/src/crypto/key.rsXOnlyPublicKeyInspect captured patch +9 / −4
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index 5ad7d422..7f83c0e0 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -62,7 +62,12 @@ impl XOnlyPublicKey {
/// Returns the inner secp256k1 x-only public key.
#[inline]
- pub fn into_inner(self) -> secp256k1::XOnlyPublicKey { self.0 }
+ pub fn to_inner(self) -> secp256k1::XOnlyPublicKey { self.0 }
+
+ /// Returns the inner secp256k1 x-only public key.
+ #[inline]
+ #[deprecated(since = "TBD", note = "use `to_inner()` instead")]
+ pub fn into_inner(self) -> secp256k1::XOnlyPublicKey { self.to_inner() }
/// Serializes the x-only public key as a byte-encoded x coordinate value (32 bytes).
#[inline]
@@ -1915,7 +1920,7 @@ mod tests {
}
#[test]
- fn xonly_pubkey_into_inner() {
+ fn xonly_pubkey_to_inner() {
let key_bytes = &<[u8; 32]>::from_hex(
"5b1e57ec453cd33fdc7cfc901450a3931fd315422558f2fb7fefb064e6e7d60d",
)
@@ -1923,8 +1928,8 @@ mod tests {
let inner_key = secp256k1::XOnlyPublicKey::from_byte_array(*key_bytes)
.expect("Failed to create a secp256k1 x-only public key from a byte array");
let btc_pubkey = XOnlyPublicKey::new(inner_key);
- // Confirm that the into_inner() returns the same data that was initially wrapped
- assert_eq!(inner_key, btc_pubkey.into_inner());
+ // Confirm that the to_inner() returns the same data that was initially wrapped
+ assert_eq!(inner_key, btc_pubkey.to_inner());
}
#[test]
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.