zebra/zebra-chain/src/transaction
Janito Vaqueiro Ferreira Filho ec2c980bb1
Validate transaction lock times (#3060)
* Create a `LockTime::unlocked` helper constructor

Returns a `LockTime` that is unlocked at the genesis block.

* Return `Option<LockTime>` from `lock_time` method

Prepare to return `None` for when a transaction has its lock time
disabled.

* Return `None` instead of zero `LockTime`

Because a zero lock time means that the transaction was unlocked at the
genesis block, so it was never actually locked.

* Rephrase zero lock time check comment

Clarify that the check is not redundant, and is necessary for the
genesis transaction.

Co-authored-by: teor <teor@riseup.net>

* Add a `transparent::Input::sequence` getter method

Retrieve a transparent input's sequence number.

* Check if lock time is enabled by a sequence number

Validate the consensus rule that the lock time is only enabled if at
least one transparent input has a value different from `u32::MAX` as its
sequence number.

* Add more Zcash specific details to comment

Explain the Zcash specific lock time behaviors.

Co-authored-by: teor <teor@riseup.net>

* Add `time` field to `Request::Block` variant

The block time to use to check if the transaction was unlocked and
allowed to be included in the block.

* Add `Request::block_time` getter

Returns the block time for the block that owns the transaction being
validated or the current time plus a tolerance for mempool transactions.

* Validate transaction lock times

If they are enabled by a transaction's transparent input sequence
numbers, make sure that they are in the past.

* Add comments with consensus rule parts

Make it easier to map what part of the consensus rule each match arm is
responsible for.

Co-authored-by: teor <teor@riseup.net>
2021-11-23 05:53:53 +00:00
..
tests Validate coinbase expiration height (#3082) 2021-11-23 05:17:05 +00:00
arbitrary.rs Validate coinbase expiration height (#3082) 2021-11-23 05:17:05 +00:00
auth_digest.rs Stop ignoring the mempool conflicting transaction reject list size limit (#2855) 2021-10-12 10:35:50 +10:00
hash.rs Use unmined types for transaction verifier mempool requests and responses (#2666) 2021-08-25 21:02:47 +00:00
joinsplit.rs Sprout note commitment trees (#3051) 2021-11-18 23:05:52 +00:00
lock_time.rs Validate transaction lock times (#3060) 2021-11-23 05:53:53 +00:00
memo.rs Fix a test failure due to ' debug format changes in Rust 2021-04-14 23:45:36 -04:00
serialize.rs Simplify preallocate tests (#3032) 2021-11-11 07:53:21 +10:00
sighash.rs Always compute sighash with librustzcash (#2469) 2021-07-09 09:55:08 +10:00
tests.rs Move the preallocate tests into their own files (#1977) 2021-04-07 12:32:27 +10:00
txid.rs Add ZIP-0244 TxId Digest support (#2129) 2021-07-06 09:58:22 -03:00
unmined.rs ZIP-401: weighted random mempool eviction (#2889) 2021-10-27 00:21:19 +00:00