Skip to content

Commit

Permalink
change to saturating sub
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Dec 5, 2024
1 parent f062c7e commit f2a83a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sharechain/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ impl ShareChain for InMemoryShareChain {
};
if let Some(level) = p2_chain_read_lock.level_at_height(height) {
if let Some(block) = level.block_in_main_chain() {
let index = i_have_blocks.len() - counter - 1;
let index = i_have_blocks.len().saturating_sub(counter).saturating_sub(1);
i_have_blocks[index] = (height, block.hash);
counter += 1;
}
Expand Down

0 comments on commit f2a83a8

Please sign in to comment.