From 52198dd62da7c4066f6f04fc38aa418480a5e5af Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 18 Oct 2023 10:30:45 +1100 Subject: [PATCH] Manually implement is_uncompressed for BitcoinKey The `interpreter::BitcoinKey` uses the default implementation of `MiniscriptKey`, which means `is_uncompressed` returns `false`. However if the full key is a `bitcoin::PublicKey` it may be compressed. Manually implement `MiniscriptKey::is_uncompressed` for `BitcoinKey` and return the compressedness of the inner full key. --- src/interpreter/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 55ec97ed4..af405bda9 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -123,6 +123,13 @@ impl MiniscriptKey for BitcoinKey { type Hash256 = hash256::Hash; type Ripemd160 = ripemd160::Hash; type Hash160 = hash160::Hash; + + fn is_uncompressed(&self) -> bool { + match *self { + BitcoinKey::Fullkey(pk) => !pk.compressed, + BitcoinKey::XOnlyPublicKey(_) => false, + } + } } impl<'txin> Interpreter<'txin> {