Mempool only CHECKLOCKTIMEVERIFY (BIP65) verification

Essentially makes passing CHECKLOCKTIMEVERIFY (BIP65) an IsStandard() rule to make it easy to test applications using it; blocks containing transactions with invalid CHECKLOCKTIMEVERIFY arguments are still accepted.

This pull-req is *not* a soft-fork nor does it contain any code to start that process.

An alternative would be to make a command-line flag to enable CLTV, however actually implementing that is somewhat ugly. There is a small risk of people thinking that it's safe to depend on CLTV, although I think that's outweighed by the value of thoroughly testing everything but the soft-fork itself.

Thanks for @sipa and also @btcdrak for the rebase. Credit goes to @gmaxwell for the suggestion of comparing the argument against the transaction nLockTime rather than the current time/blockheight directly.

Background: BIP65 - https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
You're reading it backwards: we're trying to prevent someone from *bypassing* the nLockTime of the transaction by setting every nSequence field to MAXINT.

As for the order of the tests, I designed it to go from least data required to prove to most.

On 17 December 2014 09:21:43 GMT-05:00, SergioDemianLerner <notifications@github.com> wrote:
>> +    if (nLockTime > (int64_t)txTo.nLockTime)
>> +        return false;
>> +
>> +    // Finally the nLockTime feature can be disabled and thus
>> +    // CHECKLOCKTIMEVERIFY bypassed if every txin has been
>> +    // finalized by setting nSequence to maxint. The
>> +    // transaction would be allowed into the blockchain, making
>> +    // the opcode ineffective.
>> +    //
>> +    // Testing if this vin is not final is sufficient to
>> +    // prevent this condition. Alternatively we could test all
>> +    // inputs, but testing just this input minimizes the data
>> +    // required to prove correct CHECKLOCKTIMEVERIFY execution.
>> +    if (txTo.vin[nIn].IsFinal())
>> +        return false;
>> +
>
>I don't understand why this check returns false and why it's not done
>before (nLockTime > (int64_t)txTo.nLockTime). The comment says that if
>IsFinal() = true, then the CHECKLOCKTIMEVERIFY is bypassed (accepted).
>
>---
>Reply to this email directly or view it on GitHub:
>https://github.com/bitcoin/bitcoin/pull/5496/files#r21973702