diff --git a/zebra-chain/src/transaction.rs b/zebra-chain/src/transaction.rs index 544f969dd66..315e7ce5bf2 100644 --- a/zebra-chain/src/transaction.rs +++ b/zebra-chain/src/transaction.rs @@ -296,9 +296,15 @@ impl Transaction { match self { Transaction::V1 { .. } => None, Transaction::V2 { .. } => None, - Transaction::V3 { expiry_height, .. } => Some(*expiry_height), - Transaction::V4 { expiry_height, .. } => Some(*expiry_height), - Transaction::V5 { expiry_height, .. } => Some(*expiry_height), + Transaction::V3 { expiry_height, .. } + | Transaction::V4 { expiry_height, .. } + | Transaction::V5 { expiry_height, .. } => match expiry_height { + // Consensus rule: + // > No limit: To set no limit on transactions (so that they do not expire), nExpiryHeight should be set to 0. + // https://zips.z.cash/zip-0203#specification + block::Height(0) => None, + block::Height(expiry_height) => Some(block::Height(*expiry_height)), + }, } } diff --git a/zebra-consensus/src/block/tests.rs b/zebra-consensus/src/block/tests.rs index 601d2f8a191..2ef3c2d6dde 100644 --- a/zebra-consensus/src/block/tests.rs +++ b/zebra-consensus/src/block/tests.rs @@ -391,7 +391,7 @@ fn founders_reward_validation_failure() -> Result<(), Report> { inputs: transaction.inputs().to_vec(), outputs: vec![transaction.outputs()[0].clone()], lock_time: transaction.lock_time(), - expiry_height: transaction.expiry_height().unwrap(), + expiry_height: Height(0), joinsplit_data: None, }) .unwrap();