Skip to content

Commit a94ee8d

Browse files
committed
Fix int_plus_one warnings
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 0ee5d7c commit a94ee8d

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

stackslib/src/chainstate/nakamoto/shadow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,8 @@ impl NakamotoBlockBuilder {
632632
))
633633
})?;
634634

635-
if naka_tip_header.anchored_header.height() + 1
636-
<= naka_tip_tenure_start_header.anchored_header.height()
635+
if naka_tip_header.anchored_header.height()
636+
< naka_tip_tenure_start_header.anchored_header.height()
637637
{
638638
return Err(Error::InvalidStacksBlock(
639639
"Nakamoto tip is lower than its tenure-start block".into(),

stackslib/src/chainstate/stacks/index/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl Trie {
378378
// append the new leaf and the end of the file.
379379
let new_leaf_disk_ptr = storage.last_ptr()?;
380380
let new_leaf_chr = cursor.path[cursor.tell()]; // NOTE: this is safe because !cursor.eop()
381-
let new_leaf_path = cursor.path[(if cursor.tell() + 1 <= cursor.path.len() {
381+
let new_leaf_path = cursor.path[(if cursor.tell() < cursor.path.len() {
382382
cursor.tell() + 1
383383
} else {
384384
cursor.path.len()

stackslib/src/chainstate/stacks/tests/block_construction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,7 @@ fn test_build_anchored_blocks_invalid() {
23272327

23282328
eprintln!("\n\nat resume parent tenure:\nlast_parent: {:?}\nlast_parent_tip: {:?}\n\n", &last_parent, &last_parent_tip);
23292329
}
2330-
else if tenure_id >= bad_block_tenure + 1 {
2330+
else if tenure_id > bad_block_tenure {
23312331
last_parent = None;
23322332
last_parent_tip = None;
23332333
}

stackslib/src/net/relay.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl RelayerStats {
286286
let mut to_remove = vec![];
287287
for (ts, old_addr) in self.relay_updates.iter() {
288288
self.relay_stats.remove(old_addr);
289-
if self.relay_stats.len() <= MAX_RELAYER_STATS - 1 {
289+
if self.relay_stats.len() < MAX_RELAYER_STATS {
290290
break;
291291
}
292292
to_remove.push(*ts);
@@ -342,7 +342,7 @@ impl RelayerStats {
342342
let mut to_remove = vec![];
343343
for (ts, old_nk) in self.recent_updates.iter() {
344344
self.recent_messages.remove(old_nk);
345-
if self.recent_messages.len() <= (MAX_RELAYER_STATS as usize) - 1 {
345+
if self.recent_messages.len() < MAX_RELAYER_STATS {
346346
break;
347347
}
348348
to_remove.push(*ts);

0 commit comments

Comments
 (0)