From ee4123418f1cc192b09c9f27bc6c7d50b1a0b24e Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:31:12 +0800 Subject: [PATCH] fix: end_segment_index (#221) * fix: end_segment_index --- node/log_entry_sync/src/sync_manager/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/node/log_entry_sync/src/sync_manager/mod.rs b/node/log_entry_sync/src/sync_manager/mod.rs index 48b3558..106cc42 100644 --- a/node/log_entry_sync/src/sync_manager/mod.rs +++ b/node/log_entry_sync/src/sync_manager/mod.rs @@ -483,10 +483,9 @@ impl LogSyncManager { let store = self.store.clone(); let shard_config = store.flow().get_shard_config(); let start_segment_index = tx.start_entry_index as usize / PORA_CHUNK_SIZE; - let sector_size = bytes_to_chunks(tx.size as usize); - let end_segment_index = start_segment_index - + ((sector_size + PORA_CHUNK_SIZE - 1) / PORA_CHUNK_SIZE) - - 1; + let end_segment_index = + (tx.start_entry_index as usize + bytes_to_chunks(tx.size as usize) - 1) + / PORA_CHUNK_SIZE; let mut can_finalize = false; if end_segment_index < shard_config.shard_id { can_finalize = true;