File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -440,12 +440,17 @@ impl Script {
440
440
/// Checks whether a script pubkey is a p2pk output
441
441
#[ inline]
442
442
pub fn is_p2pk ( & self ) -> bool {
443
- ( self . 0 . len ( ) == 67 &&
444
- self . 0 [ 0 ] == opcodes:: all:: OP_PUSHBYTES_65 . into_u8 ( ) &&
445
- self . 0 [ 66 ] == opcodes:: all:: OP_CHECKSIG . into_u8 ( ) )
446
- || ( self . 0 . len ( ) == 35 &&
447
- self . 0 [ 0 ] == opcodes:: all:: OP_PUSHBYTES_33 . into_u8 ( ) &&
448
- self . 0 [ 34 ] == opcodes:: all:: OP_CHECKSIG . into_u8 ( ) )
443
+ match self . len ( ) {
444
+ 67 => {
445
+ self . 0 [ 0 ] == opcodes:: all:: OP_PUSHBYTES_65 . into_u8 ( )
446
+ && self . 0 [ 66 ] == opcodes:: all:: OP_CHECKSIG . into_u8 ( )
447
+ }
448
+ 35 => {
449
+ self . 0 [ 0 ] == opcodes:: all:: OP_PUSHBYTES_33 . into_u8 ( )
450
+ && self . 0 [ 34 ] == opcodes:: all:: OP_CHECKSIG . into_u8 ( )
451
+ }
452
+ _ => false
453
+ }
449
454
}
450
455
451
456
/// Checks whether a script pubkey is a Segregated Witness (segwit) program.
You can’t perform that action at this time.
0 commit comments