Merge rust-bitcoin/rust-bitcoin#2858: clarify the meaning of `Height` & `Time` based locktime.

16e4d22693 clarify the meaning of Height & Time based locktime. (Divyansh Gupta)

Pull request description:

  this pr aims to fix : #2697

ACKs for top commit:
  apoelstra:
    ACK 16e4d22693
  tcharding:
    ACK 16e4d22693

Tree-SHA512: 55757d7e593cb284aff7040cf3298931c7f3d8e9e36d7328bd748a39be743e5c4202c55505add0219b2766d35d1660affc5ed4a7b9480b3a3bfb89982fe3970a
This commit is contained in:
Andrew Poelstra 2024-06-20 13:22:04 +00:00
commit 6908d45417
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 15 additions and 0 deletions

View File

@ -129,6 +129,12 @@ impl LockTime {
/// Constructs a `LockTime` from `n`, expecting `n` to be a valid block height.
///
/// # Note
///
/// If the current block height is `h` and the locktime is set to `h`,
/// the transaction can be included in block `h+1` or later.
/// It is possible to broadcast the transaction at block height `h`.
///
/// See [`LOCK_TIME_THRESHOLD`] for definition of a valid height value.
///
/// # Examples
@ -146,6 +152,15 @@ impl LockTime {
/// Constructs a `LockTime` from `n`, expecting `n` to be a valid block time.
///
/// # Note
///
/// If the locktime is set to a timestamp `T`,
/// the transaction can be included in a block only if the median time past (MTP) of the
/// last 11 blocks is greater than `T`.
/// It is possible to broadcast the transaction once the MTP is greater than `T`.[see BIP-113]
///
/// [BIP-113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
///
/// See [`LOCK_TIME_THRESHOLD`] for definition of a valid time value.
///
/// # Examples