File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -499,14 +499,25 @@ impl Script {
499
499
500
500
/// Check if this is an OP_RETURN output
501
501
pub fn is_op_return ( & self ) -> bool {
502
- !self . 0 . is_empty ( ) && ( opcodes:: All :: from ( self . 0 [ 0 ] ) == opcodes:: all:: OP_RETURN )
502
+ match self . 0 . first ( ) {
503
+ Some ( b) => * b == opcodes:: all:: OP_RETURN . into_u8 ( ) ,
504
+ None => false
505
+ }
503
506
}
504
507
505
508
/// Whether a script can be proven to have no satisfying input
506
509
pub fn is_provably_unspendable ( & self ) -> bool {
507
- !self . 0 . is_empty ( ) &&
508
- ( opcodes:: All :: from ( self . 0 [ 0 ] ) . classify ( opcodes:: ClassifyContext :: Legacy ) == opcodes:: Class :: ReturnOp ||
509
- opcodes:: All :: from ( self . 0 [ 0 ] ) . classify ( opcodes:: ClassifyContext :: Legacy ) == opcodes:: Class :: IllegalOp )
510
+ use blockdata:: opcodes:: Class :: { ReturnOp , IllegalOp } ;
511
+
512
+ match self . 0 . first ( ) {
513
+ Some ( b) => {
514
+ let first = opcodes:: All :: from ( * b) ;
515
+ let class = first. classify ( opcodes:: ClassifyContext :: Legacy ) ;
516
+
517
+ class == ReturnOp || class == IllegalOp
518
+ } ,
519
+ None => false ,
520
+ }
510
521
}
511
522
512
523
/// Gets the minimum value an output with this script should have in order to be
You can’t perform that action at this time.
0 commit comments