Skip to content

Commit 481784e

Browse files
committed
Merge #666: Manually implement is_uncompressed for BitcoinKey
52198dd Manually implement is_uncompressed for BitcoinKey (Tobin C. Harding) Pull request description: 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. Originally done, and discussed, in #620. ACKs for top commit: apoelstra: ACK 52198dd Tree-SHA512: 59f514d24120cfc452e60c361f851280b0515e4b63eb5d2a94d84e39821e6c80f3af07eee5fc5f80bd7198d2e09c6e4465f6f6ef3e8f38dba87ef77a2e1a3b9a
2 parents fb3f36a + 52198dd commit 481784e

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)