Skip to content

Commit 52198dd

Browse files
committed
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.
1 parent fb3f36a commit 52198dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/interpreter/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ impl MiniscriptKey for BitcoinKey {
123123
type Hash256 = hash256::Hash;
124124
type Ripemd160 = ripemd160::Hash;
125125
type Hash160 = hash160::Hash;
126+
127+
fn is_uncompressed(&self) -> bool {
128+
match *self {
129+
BitcoinKey::Fullkey(pk) => !pk.compressed,
130+
BitcoinKey::XOnlyPublicKey(_) => false,
131+
}
132+
}
126133
}
127134

128135
impl<'txin> Interpreter<'txin> {

0 commit comments

Comments
 (0)