diff --git a/base_layer/core/src/validation/helpers.rs b/base_layer/core/src/validation/helpers.rs index 047a80fb7b..ef7e903f67 100644 --- a/base_layer/core/src/validation/helpers.rs +++ b/base_layer/core/src/validation/helpers.rs @@ -76,7 +76,7 @@ pub fn calc_median_timestamp(timestamps: &[EpochTime]) -> EpochTime { // To make the linter happy, we use `u64::MAX` in the impossible case that the cast fails EpochTime::from( u64::try_from( - u128::from(timestamps[mid_index - 1].as_u64()) + u128::from(timestamps[mid_index].as_u64()) / 2, + (u128::from(timestamps[mid_index - 1].as_u64()) + u128::from(timestamps[mid_index].as_u64())) / 2, ) .unwrap_or(u64::MAX), ) diff --git a/infrastructure/tari_script/src/script.rs b/infrastructure/tari_script/src/script.rs index 09935a0d84..a8ea847429 100644 --- a/infrastructure/tari_script/src/script.rs +++ b/infrastructure/tari_script/src/script.rs @@ -20,10 +20,7 @@ use std::{cmp::Ordering, collections::HashSet, convert::TryFrom, fmt, io, ops::D use blake2::Blake2b; use borsh::{BorshDeserialize, BorshSerialize}; -use digest::{ - consts::U32, - Digest, -}; +use digest::{consts::U32, Digest}; use integer_encoding::{VarIntReader, VarIntWriter}; use sha2::Sha256; use sha3::Sha3_256;