@@ -135,7 +135,7 @@ pub(super) fn from_txdata<'txin>(
135
135
let pk = pk_from_stack_elem ( & elem, false ) ?;
136
136
if * spk
137
137
== bitcoin_primitives:: ScriptBuf :: new_p2pkh (
138
- & pk. to_pubkeyhash ( SigType :: Ecdsa ) . into ( ) ,
138
+ pk. to_pubkeyhash ( SigType :: Ecdsa ) . into ( ) ,
139
139
)
140
140
{
141
141
Ok ( (
@@ -159,11 +159,11 @@ pub(super) fn from_txdata<'txin>(
159
159
Some ( elem) => {
160
160
let pk = pk_from_stack_elem ( & elem, true ) ?;
161
161
let hash160 = pk. to_pubkeyhash ( SigType :: Ecdsa ) ;
162
- if * spk == bitcoin_primitives:: ScriptBuf :: new_p2wpkh ( & hash160. into ( ) ) {
162
+ if * spk == bitcoin_primitives:: ScriptBuf :: new_p2wpkh ( hash160. into ( ) ) {
163
163
Ok ( (
164
164
Inner :: PublicKey ( pk. into ( ) , PubkeyType :: Wpkh ) ,
165
165
wit_stack,
166
- Some ( bitcoin_primitives:: ScriptBuf :: new_p2pkh ( & hash160. into ( ) ) ) , // bip143, why..
166
+ Some ( bitcoin_primitives:: ScriptBuf :: new_p2pkh ( hash160. into ( ) ) ) , // bip143, why..
167
167
) )
168
168
} else {
169
169
Err ( Error :: IncorrectWPubkeyHash )
@@ -183,7 +183,7 @@ pub(super) fn from_txdata<'txin>(
183
183
let script = miniscript. encode ( ) ;
184
184
let miniscript = miniscript. to_no_checks_ms ( ) ;
185
185
let scripthash = sha256:: Hash :: hash ( script. as_bytes ( ) ) ;
186
- if * spk == bitcoin_primitives:: ScriptBuf :: new_p2wsh ( & scripthash. into ( ) ) {
186
+ if * spk == bitcoin_primitives:: ScriptBuf :: new_p2wsh ( scripthash. into ( ) ) {
187
187
Ok ( ( Inner :: Script ( miniscript, ScriptType :: Wsh ) , wit_stack, Some ( script) ) )
188
188
} else {
189
189
Err ( Error :: IncorrectWScriptHash )
@@ -255,7 +255,7 @@ pub(super) fn from_txdata<'txin>(
255
255
Some ( elem) => {
256
256
if let stack:: Element :: Push ( slice) = elem {
257
257
let scripthash = hash160:: Hash :: hash ( slice) ;
258
- if * spk != bitcoin_primitives:: ScriptBuf :: new_p2sh ( & scripthash. into ( ) ) {
258
+ if * spk != bitcoin_primitives:: ScriptBuf :: new_p2sh ( scripthash. into ( ) ) {
259
259
return Err ( Error :: IncorrectScriptHash ) ;
260
260
}
261
261
// ** p2sh-wrapped wpkh **
@@ -269,15 +269,15 @@ pub(super) fn from_txdata<'txin>(
269
269
let hash160 = pk. to_pubkeyhash ( SigType :: Ecdsa ) ;
270
270
if slice
271
271
== bitcoin_primitives:: ScriptBuf :: new_p2wpkh (
272
- & hash160. into ( ) ,
272
+ hash160. into ( ) ,
273
273
)
274
274
. as_bytes ( )
275
275
{
276
276
Ok ( (
277
277
Inner :: PublicKey ( pk. into ( ) , PubkeyType :: ShWpkh ) ,
278
278
wit_stack,
279
279
Some ( bitcoin_primitives:: ScriptBuf :: new_p2pkh (
280
- & hash160. into ( ) ,
280
+ hash160. into ( ) ,
281
281
) ) , // bip143, why..
282
282
) )
283
283
} else {
@@ -301,7 +301,7 @@ pub(super) fn from_txdata<'txin>(
301
301
let scripthash = sha256:: Hash :: hash ( script. as_bytes ( ) ) ;
302
302
if slice
303
303
== bitcoin_primitives:: ScriptBuf :: new_p2wsh (
304
- & scripthash. into ( ) ,
304
+ scripthash. into ( ) ,
305
305
)
306
306
. as_bytes ( )
307
307
{
@@ -325,7 +325,7 @@ pub(super) fn from_txdata<'txin>(
325
325
let miniscript = miniscript. to_no_checks_ms ( ) ;
326
326
if wit_stack. is_empty ( ) {
327
327
let scripthash = hash160:: Hash :: hash ( script. as_bytes ( ) ) ;
328
- if * spk == bitcoin_primitives:: ScriptBuf :: new_p2sh ( & scripthash. into ( ) ) {
328
+ if * spk == bitcoin_primitives:: ScriptBuf :: new_p2sh ( scripthash. into ( ) ) {
329
329
Ok ( ( Inner :: Script ( miniscript, ScriptType :: Sh ) , ssig_stack, Some ( script) ) )
330
330
} else {
331
331
Err ( Error :: IncorrectScriptHash )
@@ -444,12 +444,12 @@ mod tests {
444
444
445
445
let pkhash = key. to_pubkeyhash ( SigType :: Ecdsa ) . into ( ) ;
446
446
let wpkhash = key. to_pubkeyhash ( SigType :: Ecdsa ) . into ( ) ;
447
- let wpkh_spk = bitcoin_primitives:: ScriptBuf :: new_p2wpkh ( & wpkhash) ;
447
+ let wpkh_spk = bitcoin_primitives:: ScriptBuf :: new_p2wpkh ( wpkhash) ;
448
448
let wpkh_scripthash = hash160:: Hash :: hash ( wpkh_spk. as_bytes ( ) ) . into ( ) ;
449
449
450
450
KeyTestData {
451
451
pk_spk : bitcoin_primitives:: ScriptBuf :: new_p2pk ( key) ,
452
- pkh_spk : bitcoin_primitives:: ScriptBuf :: new_p2pkh ( & pkhash) ,
452
+ pkh_spk : bitcoin_primitives:: ScriptBuf :: new_p2pkh ( pkhash) ,
453
453
pk_sig : script:: Builder :: new ( ) . push_slice ( dummy_sig) . into_script ( ) ,
454
454
pkh_sig : script:: Builder :: new ( )
455
455
. push_slice ( dummy_sig)
@@ -459,7 +459,7 @@ mod tests {
459
459
wpkh_spk : wpkh_spk. clone ( ) ,
460
460
wpkh_stack : Witness :: from_slice ( & [ dummy_sig_vec. clone ( ) , key. to_bytes ( ) ] ) ,
461
461
wpkh_stack_justkey : Witness :: from_slice ( & [ key. to_bytes ( ) ] ) ,
462
- sh_wpkh_spk : bitcoin_primitives:: ScriptBuf :: new_p2sh ( & wpkh_scripthash) ,
462
+ sh_wpkh_spk : bitcoin_primitives:: ScriptBuf :: new_p2sh ( wpkh_scripthash) ,
463
463
sh_wpkh_sig : script:: Builder :: new ( )
464
464
. push_slice ( <& PushBytes >:: try_from ( wpkh_spk[ ..] . as_bytes ( ) ) . unwrap ( ) )
465
465
. into_script ( ) ,
@@ -734,7 +734,7 @@ mod tests {
734
734
let ( miniscript, redeem_script) = ms_inner_script ( & format ! ( "hash160({})" , hash) ) ;
735
735
let rs_hash = hash160:: Hash :: hash ( redeem_script. as_bytes ( ) ) . into ( ) ;
736
736
737
- let spk = ScriptBuf :: new_p2sh ( & rs_hash) ;
737
+ let spk = ScriptBuf :: new_p2sh ( rs_hash) ;
738
738
let script_sig = script:: Builder :: new ( )
739
739
. push_slice ( <& PushBytes >:: try_from ( redeem_script. as_bytes ( ) ) . unwrap ( ) )
740
740
. into_script ( ) ;
@@ -770,7 +770,7 @@ mod tests {
770
770
let wit_hash = sha256:: Hash :: hash ( witness_script. as_bytes ( ) ) . into ( ) ;
771
771
let wit_stack = Witness :: from_slice ( & [ witness_script. to_bytes ( ) ] ) ;
772
772
773
- let spk = ScriptBuf :: new_p2wsh ( & wit_hash) ;
773
+ let spk = ScriptBuf :: new_p2wsh ( wit_hash) ;
774
774
let blank_script = bitcoin_primitives:: ScriptBuf :: new ( ) ;
775
775
776
776
// wsh without witness
@@ -805,14 +805,14 @@ mod tests {
805
805
let wit_hash = sha256:: Hash :: hash ( witness_script. as_bytes ( ) ) . into ( ) ;
806
806
let wit_stack = Witness :: from_slice ( & [ witness_script. to_bytes ( ) ] ) ;
807
807
808
- let redeem_script = ScriptBuf :: new_p2wsh ( & wit_hash) ;
808
+ let redeem_script = ScriptBuf :: new_p2wsh ( wit_hash) ;
809
809
let script_sig = script:: Builder :: new ( )
810
810
. push_slice ( <& PushBytes >:: try_from ( redeem_script. as_bytes ( ) ) . unwrap ( ) )
811
811
. into_script ( ) ;
812
812
let blank_script = bitcoin_primitives:: ScriptBuf :: new ( ) ;
813
813
814
814
let rs_hash = hash160:: Hash :: hash ( redeem_script. as_bytes ( ) ) . into ( ) ;
815
- let spk = ScriptBuf :: new_p2sh ( & rs_hash) ;
815
+ let spk = ScriptBuf :: new_p2sh ( rs_hash) ;
816
816
817
817
// shwsh without witness or scriptsig
818
818
let err = from_txdata ( & spk, & blank_script, & Witness :: default ( ) ) . unwrap_err ( ) ;
0 commit comments