From 4fc49f8cda49070da8f2d45b1c9d0385926f877a Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Fri, 10 Nov 2023 14:43:39 +0100 Subject: [PATCH] fix: race condition on upload and use encodings in hash tree Signed-off-by: David Dal Busco --- src/satellite/src/storage/certification/impls.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/satellite/src/storage/certification/impls.rs b/src/satellite/src/storage/certification/impls.rs index a03a00d60..1affbc28b 100644 --- a/src/satellite/src/storage/certification/impls.rs +++ b/src/satellite/src/storage/certification/impls.rs @@ -89,7 +89,7 @@ impl CertifiedAssetHashes { pub fn insert(&mut self, asset: &Asset, config: &StorageConfig) { let full_path = asset.key.full_path.clone(); - for encoding_type in ENCODING_CERTIFICATION_ORDER.iter() { + for encoding_type in ENCODING_CERTIFICATION_ORDER.iter().rev() { if let Some(encoding) = asset.encodings.get(*encoding_type) { self.insert_v1(&full_path, encoding.sha256); self.insert_v2( @@ -213,7 +213,7 @@ impl CertifiedAssetHashes { asset: &Asset, config: &StorageConfig, ) { - for encoding_type in ENCODING_CERTIFICATION_ORDER.iter() { + for encoding_type in ENCODING_CERTIFICATION_ORDER.iter().rev() { if let Some(encoding) = asset.encodings.get(*encoding_type) { self.insert_rewrite_into_tree_v2( full_path,