1

Looking at the BIP65, it says that the CLTV will fail if the nSequence field of the txin is 0xffffffff. It seems logical to me since if the nSequence of all inputs are set to 0xffffffff, the value of nLocktime and absolute time are not taken into consideration. However, does the nSequence of the input that consumes output with CLTV must be != 0xffffffff, or the nSequence of any input inside the transaction can be != 0xffffffff and the input that consumes output with CLTV can stay with nSequence set to 0xffffffff and that CLTV still pass? I am asking because in both cases the locktime and absolute time lock will be taken into consideration, that is, the locktime will be activated. Thanks.

1 Answer 1

4

Citing BIP65, which introduced OP_CHECKLOCKTIMEVERIFY:

When executed, if any of the following conditions are true, the script interpreter will terminate with an error:

  • the stack is empty; or
  • the top item on the stack is less than 0; or
  • the lock-time type (height vs. timestamp) of the top stack item and the nLockTime field are not the same; or
  • the top stack item is greater than the transaction's nLockTime field; or the nSequence field of the txin is 0xffffffff;

(emphasis mine)

So OP_CHECKLOCKTIMEVERIFY requires the nSequence value of the spending input itself to not be 0xffffffff. While it technically suffices that at least one input has a non-0xffffffff nSequence for the spending transaction to have a relevant nLockTime, the choice was made in BIP65 to require that the input itself has such an nSequence. According to the implementation's source code, this was done to minimize the amount of data needed to prove an input is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.