fix(era): SlotIndex offset support negative value (#18047)

This commit is contained in:
nk_ysg
2025-08-27 16:28:28 +08:00
committed by GitHub
parent 28774f7ad4
commit f67e7547df
5 changed files with 32 additions and 18 deletions

View File

@@ -153,8 +153,8 @@ where
let mut writer = Era1Writer::new(file);
writer.write_version()?;
let mut offsets = Vec::<u64>::with_capacity(block_count);
let mut position = VERSION_ENTRY_SIZE as u64;
let mut offsets = Vec::<i64>::with_capacity(block_count);
let mut position = VERSION_ENTRY_SIZE as i64;
let mut blocks_written = 0;
let mut final_header_data = Vec::new();
@@ -179,7 +179,7 @@ where
let body_size = compressed_body.data.len() + ENTRY_HEADER_SIZE;
let receipts_size = compressed_receipts.data.len() + ENTRY_HEADER_SIZE;
let difficulty_size = 32 + ENTRY_HEADER_SIZE; // U256 is 32 + 8 bytes header overhead
let total_size = (header_size + body_size + receipts_size + difficulty_size) as u64;
let total_size = (header_size + body_size + receipts_size + difficulty_size) as i64;
let block_tuple = BlockTuple::new(
compressed_header,