From 1ce00f90fea3f1f078e22387442087c5ca7329b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Thu, 4 Mar 2021 13:36:06 +0100 Subject: [PATCH] fix: don't accept incoming pdus if we know about them already --- src/server_server.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/server_server.rs b/src/server_server.rs index 00f31ca3..d5898182 100644 --- a/src/server_server.rs +++ b/src/server_server.rs @@ -554,6 +554,12 @@ pub async fn send_transaction_message_route<'a>( // TODO: redact event if hashing fails let (event_id, value) = crate::pdu::process_incoming_pdu(pdu); + // Skip the pdu if we already know about it + if db.rooms.get_pdu_id(&event_id)?.is_some() { + resolved_map.insert(event_id, Err("We already know about this event".into())); + continue; + } + let pdu = serde_json::from_value::( serde_json::to_value(&value).expect("CanonicalJsonObj is a valid JsonValue"), )