@@ -22,7 +22,7 @@ define_extension_trait! {
22
22
/// Extension functionality to add scriptPubkey support to the [`Builder`] type.
23
23
pub trait BuilderExt impl for Builder {
24
24
/// Adds instructions to push a public key onto the stack.
25
- fn push_key( self , key: PublicKey ) -> Builder {
25
+ fn push_key( self : Self , key: PublicKey ) -> Builder {
26
26
if key. compressed {
27
27
self . push_slice( key. inner. serialize( ) )
28
28
} else {
@@ -31,7 +31,7 @@ define_extension_trait! {
31
31
}
32
32
33
33
/// Adds instructions to push an XOnly public key onto the stack.
34
- fn push_x_only_key( self , x_only_key: XOnlyPublicKey ) -> Builder {
34
+ fn push_x_only_key( self : Self , x_only_key: XOnlyPublicKey ) -> Builder {
35
35
self . push_slice( x_only_key. serialize( ) )
36
36
}
37
37
}
@@ -42,14 +42,14 @@ define_extension_trait! {
42
42
pub trait ScriptExt impl for Script {
43
43
/// Computes the P2WSH output corresponding to this witnessScript (aka the "witness redeem
44
44
/// script").
45
- fn to_p2wsh( & self ) -> Result <ScriptBuf , WitnessScriptSizeError > {
45
+ fn to_p2wsh( self : & Self ) -> Result <ScriptBuf , WitnessScriptSizeError > {
46
46
self . wscript_hash( ) . map( ScriptBuf :: new_p2wsh)
47
47
}
48
48
49
49
/// Computes P2TR output with a given internal key and a single script spending path equal to
50
50
/// the current script, assuming that the script is a Tapscript.
51
51
fn to_p2tr<C : Verification >(
52
- & self ,
52
+ self : & Self ,
53
53
secp: & Secp256k1 <C >,
54
54
internal_key: UntweakedPublicKey ,
55
55
) -> ScriptBuf {
@@ -59,15 +59,15 @@ define_extension_trait! {
59
59
}
60
60
61
61
/// Computes the P2SH output corresponding to this redeem script.
62
- fn to_p2sh( & self ) -> Result <ScriptBuf , RedeemScriptSizeError > {
62
+ fn to_p2sh( self : & Self ) -> Result <ScriptBuf , RedeemScriptSizeError > {
63
63
self . script_hash( ) . map( ScriptBuf :: new_p2sh)
64
64
}
65
65
66
66
/// Returns the script code used for spending a P2WPKH output if this script is a script pubkey
67
67
/// for a P2WPKH output. The `scriptCode` is described in [BIP143].
68
68
///
69
69
/// [BIP143]: <https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki>
70
- fn p2wpkh_script_code( & self ) -> Option <ScriptBuf > {
70
+ fn p2wpkh_script_code( self : & Self ) -> Option <ScriptBuf > {
71
71
if self . is_p2wpkh( ) {
72
72
// The `self` script is 0x00, 0x14, <pubkey_hash>
73
73
let bytes = & self . as_bytes( ) [ 2 ..] ;
@@ -82,14 +82,14 @@ define_extension_trait! {
82
82
///
83
83
/// You can obtain the public key, if its valid,
84
84
/// by calling [`p2pk_public_key()`](Self::p2pk_public_key)
85
- fn is_p2pk( & self ) -> bool { self . p2pk_pubkey_bytes( ) . is_some( ) }
85
+ fn is_p2pk( self : & Self ) -> bool { self . p2pk_pubkey_bytes( ) . is_some( ) }
86
86
87
87
/// Returns the public key if this script is P2PK with a **valid** public key.
88
88
///
89
89
/// This may return `None` even when [`is_p2pk()`](Self::is_p2pk) returns true.
90
90
/// This happens when the public key is invalid (e.g. the point not being on the curve).
91
91
/// In this situation the script is unspendable.
92
- fn p2pk_public_key( & self ) -> Option <PublicKey > {
92
+ fn p2pk_public_key( self : & Self ) -> Option <PublicKey > {
93
93
PublicKey :: from_slice( self . p2pk_pubkey_bytes( ) ?) . ok( )
94
94
}
95
95
}
@@ -98,7 +98,7 @@ define_extension_trait! {
98
98
define_extension_trait ! {
99
99
pub ( crate ) trait ScriptExtPrivate impl for Script {
100
100
/// Returns the bytes of the (possibly invalid) public key if this script is P2PK.
101
- fn p2pk_pubkey_bytes( & self ) -> Option <& [ u8 ] > {
101
+ fn p2pk_pubkey_bytes( self : & Self ) -> Option <& [ u8 ] > {
102
102
match self . len( ) {
103
103
67 if self . as_bytes( ) [ 0 ] == OP_PUSHBYTES_65 . to_u8( )
104
104
&& self . as_bytes( ) [ 66 ] == OP_CHECKSIG . to_u8( ) =>
0 commit comments