pub fn lock_time_has_passed(
    tx: &Transaction,
    block_height: Height,
    block_time: DateTime<Utc>,
) -> Result<(), TransactionError> {
    match tx.lock_time() {
        Some(LockTime::Height(unlock_height)) => {
            // > The transaction can be added to any block which has a greater height.
            // The Bitcoin documentation is wrong or outdated here,
            // so this code is based on the `zcashd` implementation at:
            // https://github.com/zcash/zcash/blob/1a7c2a3b04bcad6549be6d571bfdff8af9a2c814/src/main.cpp#L722
            if block_height > unlock_height {
                Ok(())
            } else {
                Err(TransactionError::LockedUntilAfterBlockHeight(unlock_height))
            }
        }
        Some(LockTime::Time(unlock_time)) => {
            // > The transaction can be added to any block whose block time is greater than the locktime.
            // https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number
            if block_time > unlock_time {
                Ok(())
            } else {
                Err(TransactionError::LockedUntilAfterBlockTime(unlock_time))
            }
        }
        None => Ok(()),
    }
}
/// Checks if the transaction's lock time allows this transaction to be included in a block.
///
/// Consensus rule:
///
/// > The transaction must be finalized: either its locktime must be in the past (or less
/// > than or equal to the current block height), or all of its sequence numbers must be
/// > 0xffffffff.
///
/// [`Transaction::lock_time`] validates the transparent input sequence numbers, returning [`None`]
/// if they indicate that the transaction is finalized by them. Otherwise, this function validates
/// if the lock time is in the past.
Checks if the transaction's lock time allows this transaction to be included in a block.
Consensus rule.

> The transaction must be finalized: either its locktime must be in the past (or less
> than or equal to the current block height), or all of its sequence numbers must be
> 0xffffffff.

[`Transaction::lock_time`] validates the transparent input sequence numbers, returning [`None`]
if they indicate that the transaction is finalized by them. Otherwise, this function validates
if the lock time is in the past.
Checks if the transaction ' s lock time allows this transaction to be included in a block . Consensus rule . > The transaction must be finalized : either its locktime must be in the past ( or less > than or equal to the current block height ) or all of its sequence numbers must be > 0xffffffff . [ ` Transaction :: lock_time ` ] validates the transparent input sequence numbers returning [ ` None ` ] if they indicate that the transaction is finalized by them . Otherwise this function validates if the lock time is in the past .
pub fn lock_time_has_passed(
    tx: &Transaction,
    block_height: Height,
    block_time: DateTime<Utc>,
) -> Result<(), TransactionError> {
    match tx.lock_time() {
        Some(LockTime::Height(unlock_height)) => {
            // > The transaction can be added to any block which has a greater height.
            // The Bitcoin documentation is wrong or outdated here,
            // so this code is based on the `zcashd` implementation at:
            // https://github.com/zcash/zcash/blob/1a7c2a3b04bcad6549be6d571bfdff8af9a2c814/src/main.cpp#L722
            if block_height > unlock_height {
                Ok(())
            } else {
                Err(TransactionError::LockedUntilAfterBlockHeight(unlock_height))
            }
        }
        Some(LockTime::Time(unlock_time)) => {
            // > The transaction can be added to any block whose block time is greater than the locktime.
            // https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number
            if block_time > unlock_time {
                Ok(())
            } else {
                Err(TransactionError::LockedUntilAfterBlockTime(unlock_time))
            }
        }
        None => Ok(()),
    }
}
pub fn lock_time_has_passed ( tx : & Transaction , block_height : Height , block_time : DateTime < Utc > , ) -> Result < ( ) , TransactionError > { match tx . lock_time ( ) { Some ( LockTime :: Height ( unlock_height ) ) => { // > The transaction can be added to any block which has a greater height. // The Bitcoin documentation is wrong or outdated here, // so this code is based on the `zcashd` implementation at: // https://github.com/zcash/zcash/blob/1a7c2a3b04bcad6549be6d571bfdff8af9a2c814/src/main.cpp#L722 if block_height > unlock_height { Ok ( ( ) ) } else { Err ( TransactionError :: LockedUntilAfterBlockHeight ( unlock_height ) ) } } Some ( LockTime :: Time ( unlock_time ) ) => { // > The transaction can be added to any block whose block time is greater than the locktime. // https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number if block_time > unlock_time { Ok ( ( ) ) } else { Err ( TransactionError :: LockedUntilAfterBlockTime ( unlock_time ) ) } } None => Ok ( ( ) ) , } }
Checks if the transaction's lock time allows this transaction to be included in a block.
Checks if the transaction ' s lock time allows this transaction to be included in a block .
tx
&Transaction
block_height
Height
block_time
DateTime<Utc>