File tree 4 files changed +7
-12
lines changed 4 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -631,8 +631,8 @@ impl NakamotoBlockBuilder {
631
631
) )
632
632
} ) ?;
633
633
634
- if naka_tip_header. anchored_header . height ( ) + 1
635
- <= naka_tip_tenure_start_header. anchored_header . height ( )
634
+ if naka_tip_header. anchored_header . height ( )
635
+ < naka_tip_tenure_start_header. anchored_header . height ( )
636
636
{
637
637
return Err ( Error :: InvalidStacksBlock (
638
638
"Nakamoto tip is lower than its tenure-start block" . into ( ) ,
Original file line number Diff line number Diff line change @@ -372,13 +372,8 @@ impl Trie {
372
372
// append the new leaf and the end of the file.
373
373
let new_leaf_disk_ptr = storage. last_ptr ( ) ?;
374
374
let new_leaf_chr = cursor. path [ cursor. tell ( ) ] ; // NOTE: this is safe because !cursor.eop()
375
- let new_leaf_path = cursor. path [ ( if cursor. tell ( ) + 1 <= cursor. path . len ( ) {
376
- cursor. tell ( ) + 1
377
- } else {
378
- cursor. path . len ( )
379
- } ) ..]
380
- . to_vec ( ) ;
381
- new_leaf_data. path = new_leaf_path;
375
+ new_leaf_data. path =
376
+ cursor. path [ std:: cmp:: min ( cursor. tell ( ) + 1 , cursor. path . len ( ) ) ..] . to_vec ( ) ;
382
377
let new_leaf_hash = get_leaf_hash ( new_leaf_data) ;
383
378
384
379
// put new leaf at the end of this Trie
Original file line number Diff line number Diff line change @@ -2297,7 +2297,7 @@ fn test_build_anchored_blocks_invalid() {
2297
2297
2298
2298
eprintln ! ( "\n \n at resume parent tenure:\n last_parent: {:?}\n last_parent_tip: {:?}\n \n " , & last_parent, & last_parent_tip) ;
2299
2299
}
2300
- else if tenure_id >= bad_block_tenure + 1 {
2300
+ else if tenure_id > bad_block_tenure {
2301
2301
last_parent = None ;
2302
2302
last_parent_tip = None ;
2303
2303
}
Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ impl RelayerStats {
286
286
let mut to_remove = vec ! [ ] ;
287
287
for ( ts, old_addr) in self . relay_updates . iter ( ) {
288
288
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 {
290
290
break ;
291
291
}
292
292
to_remove. push ( * ts) ;
@@ -342,7 +342,7 @@ impl RelayerStats {
342
342
let mut to_remove = vec ! [ ] ;
343
343
for ( ts, old_nk) in self . recent_updates . iter ( ) {
344
344
self . recent_messages . remove ( old_nk) ;
345
- if self . recent_messages . len ( ) <= MAX_RELAYER_STATS - 1 {
345
+ if self . recent_messages . len ( ) < MAX_RELAYER_STATS {
346
346
break ;
347
347
}
348
348
to_remove. push ( * ts) ;
You can’t perform that action at this time.
0 commit comments