Truncate LockTime::Time datetimes to only seconds for proptests
This commit is contained in:
parent
71d5571e39
commit
86f631f9b7
|
|
@ -8,8 +8,6 @@ use std::{
|
||||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use chrono::{DateTime, TimeZone, Utc};
|
use chrono::{DateTime, TimeZone, Utc};
|
||||||
use hex;
|
use hex;
|
||||||
#[cfg(test)]
|
|
||||||
use proptest_derive::Arbitrary;
|
|
||||||
|
|
||||||
use crate::serialization::{
|
use crate::serialization::{
|
||||||
ReadZcashExt, SerializationError, WriteZcashExt, ZcashDeserialize, ZcashSerialize,
|
ReadZcashExt, SerializationError, WriteZcashExt, ZcashDeserialize, ZcashSerialize,
|
||||||
|
|
@ -132,7 +130,7 @@ mod proptest {
|
||||||
|
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use chrono::Utc;
|
use chrono::{TimeZone, Utc};
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
|
|
||||||
use super::{BlockHeight, LockTime};
|
use super::{BlockHeight, LockTime};
|
||||||
|
|
@ -144,7 +142,9 @@ mod proptest {
|
||||||
fn arbitrary_with(_args: ()) -> Self::Strategy {
|
fn arbitrary_with(_args: ()) -> Self::Strategy {
|
||||||
prop_oneof![
|
prop_oneof![
|
||||||
(0u32..500_000_000_u32).prop_map(|n| LockTime::Height(BlockHeight(n))),
|
(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()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue