From 86f631f9b7b35f2fd44f701134e0363836762bb7 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Thu, 19 Dec 2019 20:06:13 -0500 Subject: [PATCH] Truncate LockTime::Time datetimes to only seconds for proptests --- zebra-chain/src/types.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zebra-chain/src/types.rs b/zebra-chain/src/types.rs index a355b982..7a5dbca2 100644 --- a/zebra-chain/src/types.rs +++ b/zebra-chain/src/types.rs @@ -8,8 +8,6 @@ use std::{ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use chrono::{DateTime, TimeZone, Utc}; use hex; -#[cfg(test)] -use proptest_derive::Arbitrary; use crate::serialization::{ ReadZcashExt, SerializationError, WriteZcashExt, ZcashDeserialize, ZcashSerialize, @@ -132,7 +130,7 @@ mod proptest { use std::io::Cursor; - use chrono::Utc; + use chrono::{TimeZone, Utc}; use proptest::prelude::*; use super::{BlockHeight, LockTime}; @@ -144,7 +142,9 @@ mod proptest { fn arbitrary_with(_args: ()) -> Self::Strategy { prop_oneof![ (0u32..500_000_000_u32).prop_map(|n| LockTime::Height(BlockHeight(n))), - Just(LockTime::Time(Utc::now())) + Just(LockTime::Time( + Utc.timestamp(Utc::now().timestamp() as i64, 0) + )) ] .boxed() }