From 2cdf526ee906314723af42387ba9449f3bd91bf8 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Fri, 25 Nov 2016 16:54:56 +0300 Subject: [PATCH] using sorted list of timestamps to evaluate median --- verification/src/chain_verifier.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/verification/src/chain_verifier.rs b/verification/src/chain_verifier.rs index 27a05768..b60424c9 100644 --- a/verification/src/chain_verifier.rs +++ b/verification/src/chain_verifier.rs @@ -288,7 +288,8 @@ impl ChainVerifier { } if timestamps.len() > 2 { - let timestamps: Vec<_> = timestamps.into_iter().collect(); + let mut timestamps: Vec<_> = timestamps.into_iter().collect(); + timestamps.sort(); Some(timestamps[timestamps.len() / 2]) } else { None }