Bläddra i källkod

event_graph: fix broadcasted_ids issue when batch downloading events

dasman 11 månader sedan
förälder
incheckning
8094102614
1 ändrade filer med 8 tillägg och 3 borttagningar
  1. 8 3
      src/event_graph/proto.rs

+ 8 - 3
src/event_graph/proto.rs

@@ -526,7 +526,7 @@ impl ProtocolEventGraph {
             // reading our db and steal our bandwidth.
             // reading our db and steal our bandwidth.
             let mut events = vec![];
             let mut events = vec![];
             for event_id in event_ids.iter() {
             for event_id in event_ids.iter() {
-                /*if !self.event_graph.broadcasted_ids.read().await.contains(event_id) {
+                if !self.event_graph.header_dag.contains_key(event_id.as_bytes())? {
                     let malicious_count = self.malicious_count.fetch_add(1, SeqCst);
                     let malicious_count = self.malicious_count.fetch_add(1, SeqCst);
                     if malicious_count + 1 == MALICIOUS_THRESHOLD {
                     if malicious_count + 1 == MALICIOUS_THRESHOLD {
                         error!(
                         error!(
@@ -544,7 +544,7 @@ impl ProtocolEventGraph {
                         self.channel.display_address()
                         self.channel.display_address()
                     );
                     );
                     continue
                     continue
-                }*/
+                }
 
 
                 // At this point we should have it in our DAG.
                 // At this point we should have it in our DAG.
                 // This code panics if this is not the case.
                 // This code panics if this is not the case.
@@ -553,7 +553,12 @@ impl ProtocolEventGraph {
                     "Fetching event {event_id:?} from DAG"
                     "Fetching event {event_id:?} from DAG"
                 );
                 );
 
 
-                events.push(self.event_graph.dag_get(event_id).await?.ok_or(Error::EventNotFound("Event Not Found in DAG".to_owned()))?);
+                events.push(
+                    self.event_graph
+                        .dag_get(event_id)
+                        .await?
+                        .ok_or(Error::EventNotFound("Event Not Found in DAG".to_owned()))?,
+                );
             }
             }
 
 
             // Check if the incoming event is older than the genesis event. If so, something
             // Check if the incoming event is older than the genesis event. If so, something