From c9b951380b21726b6762bb17296c5a8df5c3e431 Mon Sep 17 00:00:00 2001 From: Marcin Date: Fri, 3 Jan 2025 09:54:47 +0100 Subject: [PATCH] Include rounds in the combined hash --- consensus/src/units/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/consensus/src/units/mod.rs b/consensus/src/units/mod.rs index d08ad22e..371d74c2 100644 --- a/consensus/src/units/mod.rs +++ b/consensus/src/units/mod.rs @@ -70,11 +70,8 @@ impl ControlHash { /// Calculate parent control hash, which includes all parent hashes into account. pub(crate) fn combine_hashes(parent_map: &NodeMap<(H::Hash, Round)>) -> H::Hash { - // TODO test without excluding rounds - let mut parents_hashes = NodeMap::with_size(parent_map.size()); - for (parent_index, &(hash, _)) in parent_map.iter() { - parents_hashes.insert(parent_index, hash); - } + // we include parent rounds with calculating hash but this is okay - we cannot + // have two units with the same hash but different rounds parent_map.using_encoded(H::hash) }