From 74d02a6f0862eaa1ea8896cdb0c901b5ae72344a Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 13 Oct 2020 08:21:15 +1000 Subject: [PATCH] Keep block tests in the same order as check::* --- zebra-consensus/src/block/tests.rs | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/zebra-consensus/src/block/tests.rs b/zebra-consensus/src/block/tests.rs index 060ef86c..c9c272c7 100644 --- a/zebra-consensus/src/block/tests.rs +++ b/zebra-consensus/src/block/tests.rs @@ -129,30 +129,6 @@ async fn check_transcripts() -> Result<(), Report> { Ok(()) } -#[test] -fn time_check_past_block() { - // This block is also verified as part of the BlockVerifier service - // tests. - let block = - Arc::::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..]) - .expect("block should deserialize"); - let now = Utc::now(); - - // This check is non-deterministic, but BLOCK_MAINNET_415000 is - // a long time in the past. So it's unlikely that the test machine - // will have a clock that's far enough in the past for the test to - // fail. - check::time_is_valid_at( - &block.header, - now, - &block - .coinbase_height() - .expect("block test vector height should be valid"), - &block.hash(), - ) - .expect("the header time from a mainnet block should be valid"); -} - #[test] fn subsidy_is_valid_test() -> Result<(), Report> { subsidy_is_valid_for_network(Network::Mainnet)?; @@ -251,3 +227,27 @@ fn founders_reward_validation_failure() -> Result<(), Report> { Ok(()) } + +#[test] +fn time_check_past_block() { + // This block is also verified as part of the BlockVerifier service + // tests. + let block = + Arc::::zcash_deserialize(&zebra_test::vectors::BLOCK_MAINNET_415000_BYTES[..]) + .expect("block should deserialize"); + let now = Utc::now(); + + // This check is non-deterministic, but BLOCK_MAINNET_415000 is + // a long time in the past. So it's unlikely that the test machine + // will have a clock that's far enough in the past for the test to + // fail. + check::time_is_valid_at( + &block.header, + now, + &block + .coinbase_height() + .expect("block test vector height should be valid"), + &block.hash(), + ) + .expect("the header time from a mainnet block should be valid"); +}