public void verify ( TransactionOutput output ) throws VerificationException { if ( output . parent != null ) { if ( ! getOutpoint ( ) . getHash ( ) . equals ( output . getParentTransaction ( ) . getTxId ( ) ) ) throw new VerificationException ( "This input does not refer to the tx containing the output." ) ; if ( getOutpoint ( ) . getIndex ( ) != output . getIndex ( ) ) throw new VerificationException ( "This input refers to a different output on the given tx." ) ; } Script pubKey = output . getScriptPubKey ( ) ; getScriptSig ( ) . correctlySpends ( getParentTransaction ( ) , getIndex ( ) , getWitness ( ) , getValue ( ) , pubKey , Script . ALL_VERIFY_FLAGS ) ; }
Verifies that this input can spend the given output . Note that this input must be a part of a transaction . Also note that the consistency of the outpoint will be checked even if this input has not been connected .