diff --git a/verification/src/timestamp.rs b/verification/src/timestamp.rs index 3aef250e..5c1487ad 100644 --- a/verification/src/timestamp.rs +++ b/verification/src/timestamp.rs @@ -1,4 +1,3 @@ -use std::collections::BTreeSet; use chain::BlockHeader; use db::{BlockHeaderProvider, BlockAncestors}; use primitives::hash::H256; @@ -14,7 +13,7 @@ pub fn median_timestamp(header: &BlockHeader, store: &BlockHeaderProvider) -> u3 /// The header should be later expected to have higher timestamp /// than this median timestamp pub fn median_timestamp_inclusive(previous_header_hash: H256, store: &BlockHeaderProvider) -> u32 { - let timestamps: BTreeSet<_> = BlockAncestors::new(previous_header_hash.clone().into(), store) + let mut timestamps: Vec<_> = BlockAncestors::new(previous_header_hash.clone().into(), store) .take(11) .map(|header| header.time) .collect(); @@ -23,6 +22,6 @@ pub fn median_timestamp_inclusive(previous_header_hash: H256, store: &BlockHeade return 0; } - let timestamps = timestamps.into_iter().collect::>(); + timestamps.sort(); timestamps[timestamps.len() / 2] }