From ee78320b2af2e3b56dd28c0aea30e051cc04f461 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Mon, 4 Dec 2023 19:02:48 +0800 Subject: [PATCH] fix: no chain_root in 1st block of the mmr activated epoch --- util/types/src/utilities/merkle_mountain_range.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/types/src/utilities/merkle_mountain_range.rs b/util/types/src/utilities/merkle_mountain_range.rs index cf468014b0..2f8a9d71b4 100644 --- a/util/types/src/utilities/merkle_mountain_range.rs +++ b/util/types/src/utilities/merkle_mountain_range.rs @@ -209,8 +209,9 @@ impl VerifiableHeader { } /// Checks if the current verifiable header is valid. - pub fn is_valid(&self, mmr_activated_epoch: EpochNumber) -> bool { - let has_chain_root = self.header().epoch().number() >= mmr_activated_epoch; + pub fn is_valid(&self, mmr_activated_epoch_number: EpochNumber) -> bool { + let mmr_activated_epoch = EpochNumberWithFraction::new(mmr_activated_epoch_number, 0, 1); + let has_chain_root = self.header().epoch() > mmr_activated_epoch; if has_chain_root { if self.header().is_genesis() { if !self.parent_chain_root().is_default() {