فهرست منبع

event_graph: fix already sync check

dasman 10 ماه پیش
والد
کامیت
842caa25e1
1فایلهای تغییر یافته به همراه12 افزوده شده و 14 حذف شده
  1. 12 14
      src/event_graph/mod.rs

+ 12 - 14
src/event_graph/mod.rs

@@ -552,24 +552,22 @@ impl EventGraph {
         }
         drop(tips);
 
-        if fast_mode {
-            // Now begin fetching the events backwards.
-            let mut missing_parents = HashSet::new();
-            for tip in considered_tips.iter() {
-                assert!(tip != &NULL_ID);
-
-                if !dag.contains_key(tip.as_bytes()).unwrap() {
-                    missing_parents.insert(*tip);
-                }
-            }
+        // Check if already in sync.
+        let mut missing_parents = HashSet::new();
+        for tip in considered_tips.iter() {
+            assert!(tip != &NULL_ID);
 
-            if missing_parents.is_empty() {
-                *self.synced.write().await = true;
-                info!(target: "event_graph::dag_sync", "[EVENTGRAPH] DAG synced successfully!");
-                return Ok(())
+            if !dag.contains_key(tip.as_bytes()).unwrap() {
+                missing_parents.insert(*tip);
             }
         }
 
+        if missing_parents.is_empty() {
+            *self.synced.write().await = true;
+            info!(target: "event_graph::dag_sync", "[EVENTGRAPH] DAG synced successfully!");
+            return Ok(())
+        }
+
         // Header sync first
         // TODO: requesting headers should be in a way that we wouldn't
         // recieve the same header(s) again, by sending our tip, other