@@ -472,10 +472,7 @@ impl<C: DagknightStore + DagknightStoreReader, O: HeaderStoreReader, D: Relation
472472
473473 let mut visited = BlockHashSet :: new ( ) ;
474474
475- loop {
476- let Some ( current) = topological_heap. pop ( ) else {
477- break ;
478- } ;
475+ while let Some ( current) = topological_heap. pop ( ) {
479476 let current_hash = current. 0 . hash ;
480477 if !visited. insert ( current_hash) {
481478 continue ;
@@ -512,12 +509,9 @@ impl<C: DagknightStore + DagknightStoreReader, O: HeaderStoreReader, D: Relation
512509
513510 // all parents here must already exist assuming topological sorting is honored
514511 // so finding one that doesn't means an error in processing and must be diagnosed
515- if let Some ( & parent) = agreeing_parents
516- . iter ( )
517- . filter ( |& & parent| !self . has ( parent) )
518- . filter ( |& & parent| tips. iter ( ) . any ( |& tip| self . reachability_service . is_chain_ancestor_of ( parent, tip) ) )
519- . next ( )
520- {
512+ if let Some ( & parent) = agreeing_parents. iter ( ) . find ( |& & parent| {
513+ !self . has ( parent) && tips. iter ( ) . any ( |& tip| self . reachability_service . is_chain_ancestor_of ( parent, tip) )
514+ } ) {
521515 last_known_tips
522516 . iter ( )
523517 . filter ( |& & lk_tip| self . reachability_service . is_dag_ancestor_of ( parent, lk_tip) )
@@ -1048,7 +1042,7 @@ mod tests {
10481042 // let tips = vec![];
10491043 println ! ( "lkt base: {:?}" , czm. find_last_known_tips( & tips, Some ( nca_2) ) . 0 ) ;
10501044 czm. fill_zone_data (
1051- & vec ! [ Hash :: from_str( "b2c22e6c802483e51e37d22a782a5a98379f39328618780e96d195eefbfa9f3e" ) . unwrap( ) ] ,
1045+ & [ Hash :: from_str ( "b2c22e6c802483e51e37d22a782a5a98379f39328618780e96d195eefbfa9f3e" ) . unwrap ( ) ] ,
10521046 Some ( nca_2) ,
10531047 ) ;
10541048 println ! ( "lkt before nca_1: {:?}" , czm. find_last_known_tips( & tips, Some ( nca_1) ) . 0 ) ;
0 commit comments