I just started learning about bitcoin scripting and wonder:

  • what if the timelock in CLTV is in the past?
  • what if the timelock in nLocktime is equal to 500.000?

2 Answers 2


If the nLockTime is less than or equal to the next block height, it can be included in the next block.

To explicitly answer your questions:

  • The CLTV op restricts the nLockTime field of the spending transaction, therefore if it is set in the past the condition is already fulfilled.
  • If the nLockTime field of a transaction is set to 500 000 it is valid to be included in any block which height is superior or equal to 500 000.
    This basically means any block right now if there is no block chain reorganization deeper than 160 000 blocks :).

This mechanism was cleverly used to discourage reorgs. First introduced in the bitcoin-core wallet, but now most wallets set the nLockTime field of their transactions to the next block.
This prevents, in a future where miners would mainly be compensated for their work by transaction fees, a pernicious incentive to rollback the last block if it included a high fee-paying transaction.


As darosior says you can only impose a timelock such that Bitcoin can be spent after a certain block height. You can't impose a timelock such that Bitcoin can only be spent before a certain block height.

A related question is this one on the possibility of a not() condition in Miniscript. As Pieter Wuille stated in that answer:

The nSequence and nLocktime fields themselves do observe time, and can only express larger-than constraints. Bitcoin transaction validity should be monotonic: once valid, absent double-spend, they remain valid.

The alternative would be a logistical nightmare. All mempool transactions would need to be reevaluated every block. Reasoning about validity of unconfirmed transactions would be a pain (e.g. what if you're paid using a tx spending the output of a soon-to-be expired tx?)

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.