public static boolean isSentToCltvPaymentChannel ( Script script ) { List < ScriptChunk > chunks = script . chunks ; if ( chunks . size ( ) != 10 ) return false ; // Check that opcodes match the pre-determined format. if ( ! chunks . get ( 0 ) . equalsOpCode ( OP_IF ) ) return false ; // chunk[1] = recipient pubkey if ( ! chunks . get ( 2 ) . equalsOpCode ( OP_CHECKSIGVERIFY ) ) return false ; if ( ! chunks . get ( 3 ) . equalsOpCode ( OP_ELSE ) ) return false ; // chunk[4] = locktime if ( ! chunks . get ( 5 ) . equalsOpCode ( OP_CHECKLOCKTIMEVERIFY ) ) return false ; if ( ! chunks . get ( 6 ) . equalsOpCode ( OP_DROP ) ) return false ; if ( ! chunks . get ( 7 ) . equalsOpCode ( OP_ENDIF ) ) return false ; // chunk[8] = sender pubkey if ( ! chunks . get ( 9 ) . equalsOpCode ( OP_CHECKSIG ) ) return false ; return true ; }
Returns whether this script matches the format used for LOCKTIMEVERIFY transactions .