@@ -157,13 +157,12 @@ fn get_descriptor(psbt: &Psbt, index: usize) -> Result<Descriptor<PublicKey>, In
157
157
// Partial sigs loses the compressed flag that is necessary
158
158
// TODO: See https://github.com/rust-bitcoin/rust-bitcoin/pull/836
159
159
// The type checker will fail again after we update to 0.28 and this can be removed
160
- let pk = bitcoin:: PublicKey :: new ( pk) ;
161
160
let addr = bitcoin:: Address :: p2pkh ( & pk, bitcoin:: Network :: Bitcoin ) ;
162
161
* script_pubkey == addr. script_pubkey ( )
163
162
} )
164
163
. next ( ) ;
165
164
match partial_sig_contains_pk {
166
- Some ( ( pk, _sig) ) => Ok ( Descriptor :: new_pkh ( bitcoin :: PublicKey :: new ( * pk) ) ) ,
165
+ Some ( ( pk, _sig) ) => Ok ( Descriptor :: new_pkh ( * pk) ) ,
167
166
None => Err ( InputError :: MissingPubkey ) ,
168
167
}
169
168
} else if script_pubkey. is_v0_p2wpkh ( ) {
@@ -174,14 +173,13 @@ fn get_descriptor(psbt: &Psbt, index: usize) -> Result<Descriptor<PublicKey>, In
174
173
. filter ( |& ( & pk, _sig) | {
175
174
// Indirect way to check the equivalence of pubkey-hashes.
176
175
// Create a pubkey hash and check if they are the same.
177
- let pk = bitcoin:: PublicKey :: new ( pk) ;
178
176
let addr = bitcoin:: Address :: p2wpkh ( & pk, bitcoin:: Network :: Bitcoin )
179
177
. expect ( "Address corresponding to valid pubkey" ) ;
180
178
* script_pubkey == addr. script_pubkey ( )
181
179
} )
182
180
. next ( ) ;
183
181
match partial_sig_contains_pk {
184
- Some ( ( pk, _sig) ) => Ok ( Descriptor :: new_wpkh ( bitcoin :: PublicKey :: new ( * pk) ) ?) ,
182
+ Some ( ( pk, _sig) ) => Ok ( Descriptor :: new_wpkh ( * pk) ?) ,
185
183
None => Err ( InputError :: MissingPubkey ) ,
186
184
}
187
185
} else if script_pubkey. is_v0_p2wsh ( ) {
@@ -233,16 +231,13 @@ fn get_descriptor(psbt: &Psbt, index: usize) -> Result<Descriptor<PublicKey>, In
233
231
. partial_sigs
234
232
. iter ( )
235
233
. filter ( |& ( & pk, _sig) | {
236
- let pk = bitcoin:: PublicKey :: new ( pk) ;
237
234
let addr = bitcoin:: Address :: p2wpkh ( & pk, bitcoin:: Network :: Bitcoin )
238
235
. expect ( "Address corresponding to valid pubkey" ) ;
239
236
* redeem_script == addr. script_pubkey ( )
240
237
} )
241
238
. next ( ) ;
242
239
match partial_sig_contains_pk {
243
- Some ( ( pk, _sig) ) => {
244
- Ok ( Descriptor :: new_sh_wpkh ( bitcoin:: PublicKey :: new ( * pk) ) ?)
245
- }
240
+ Some ( ( pk, _sig) ) => Ok ( Descriptor :: new_sh_wpkh ( * pk) ?) ,
246
241
None => Err ( InputError :: MissingPubkey ) ,
247
242
}
248
243
} else {
0 commit comments