Script { public boolean isSentToCLTVPaymentChannel() { if (chunks.size() != 10) return false; if (!chunks.get(0).equalsOpCode(OP_IF)) return false; if (!chunks.get(2).equalsOpCode(OP_CHECKSIGVERIFY)) return false; if (!chunks.get(3).equalsOpCode(OP_ELSE)) return false; 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; if (!chunks.get(9).equalsOpCode(OP_CHECKSIG)) return false; return true; } private  Script();   Script(List<ScriptChunk> chunks);  Script(byte[] programBytes);  Script(byte[] programBytes, long creationTimeSeconds); long getCreationTimeSeconds(); void setCreationTimeSeconds(long creationTimeSeconds); @Override String toString(); byte[] getProgram(); List<ScriptChunk> getChunks(); boolean isSentToRawPubKey(); boolean isSentToAddress(); @Deprecated boolean isSentToP2SH(); byte[] getPubKeyHash(); byte[] getPubKey(); byte[] getCLTVPaymentChannelSenderPubKey(); byte[] getCLTVPaymentChannelRecipientPubKey(); BigInteger getCLTVPaymentChannelExpiry(); @Deprecated Address getFromAddress(NetworkParameters params); Address getToAddress(NetworkParameters params); Address getToAddress(NetworkParameters params, boolean forcePayToPubKey); static void writeBytes(OutputStream os, byte[] buf); static byte[] createMultiSigOutputScript(int threshold, List<ECKey> pubkeys); static byte[] createInputScript(byte[] signature, byte[] pubkey); static byte[] createInputScript(byte[] signature); Script createEmptyInputScript(@Nullable ECKey key, @Nullable Script redeemScript); Script getScriptSigWithSignature(Script scriptSig, byte[] sigBytes, int index); int getSigInsertionIndex(Sha256Hash hash, ECKey signingKey); List<ECKey> getPubKeys(); static int getSigOpCount(byte[] program); static long getP2SHSigOpCount(byte[] scriptSig); int getNumberOfSignaturesRequiredToSpend(); int getNumberOfBytesRequiredToSpend(@Nullable ECKey pubKey, @Nullable Script redeemScript); boolean isPayToScriptHash(); boolean isSentToMultiSig(); boolean isSentToCLTVPaymentChannel(); static byte[] removeAllInstancesOf(byte[] inputScript, byte[] chunkToRemove); static byte[] removeAllInstancesOfOp(byte[] inputScript, int opCode); boolean isOpReturn(); boolean isUnspendable(); @Deprecated static void executeScript(@Nullable Transaction txContainingThis, long index,
                                     Script script, LinkedList<byte[]> stack, boolean enforceNullDummy); static void executeScript(@Nullable Transaction txContainingThis, long index,
                                     Script script, LinkedList<byte[]> stack, Set<VerifyFlag> verifyFlags); @Deprecated void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey); void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey,
                                Set<VerifyFlag> verifyFlags); ScriptType getScriptType(); @Override boolean equals(Object o); @Override int hashCode(); static final EnumSet<VerifyFlag> ALL_VERIFY_FLAGS; static final long MAX_SCRIPT_ELEMENT_SIZE; static final int SIG_SIZE; static final int MAX_P2SH_SIGOPS; }
@Test public void testCLTVPaymentChannelOutput() { Script script = ScriptBuilder.createCLTVPaymentChannelOutput(BigInteger.valueOf(20), new ECKey(), new ECKey()); assertTrue("script is locktime-verify", script.isSentToCLTVPaymentChannel()); }