File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ pub mod psbt;
116
116
117
117
mod util;
118
118
119
+ use std:: io:: Write ;
119
120
use std:: str:: FromStr ;
120
121
use std:: { error, fmt, hash, str} ;
121
122
@@ -155,6 +156,23 @@ pub trait MiniscriptKey: Clone + Eq + Ord + fmt::Debug + fmt::Display + hash::Ha
155
156
fn to_pubkeyhash ( & self ) -> Self :: Hash ;
156
157
}
157
158
159
+ impl MiniscriptKey for bitcoin:: secp256k1:: PublicKey {
160
+ /// `is_uncompressed` always returns `false`
161
+ fn is_uncompressed ( & self ) -> bool {
162
+ false
163
+ }
164
+
165
+ type Hash = hash160:: Hash ;
166
+
167
+ fn to_pubkeyhash ( & self ) -> Self :: Hash {
168
+ let mut engine = hash160:: Hash :: engine ( ) ;
169
+ engine
170
+ . write_all ( & self . serialize ( ) )
171
+ . expect ( "engines don't error" ) ;
172
+ hash160:: Hash :: from_engine ( engine)
173
+ }
174
+ }
175
+
158
176
impl MiniscriptKey for bitcoin:: PublicKey {
159
177
/// `is_uncompressed` returns true only for
160
178
/// bitcoin::Publickey type if the underlying key is uncompressed.
You can’t perform that action at this time.
0 commit comments