Merge branch 'incoming-pdu' into 'master'
fix: don't accept incoming pdus if we know about them already Closes #70 See merge request famedly/conduit!33
This commit is contained in:
		
						commit
						643109309b
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		|  | @ -558,6 +558,12 @@ pub async fn send_transaction_message_route<'a>( | ||||||
|         // TODO: redact event if hashing fails
 |         // TODO: redact event if hashing fails
 | ||||||
|         let (event_id, value) = crate::pdu::process_incoming_pdu(pdu); |         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::<PduEvent>( |         let pdu = serde_json::from_value::<PduEvent>( | ||||||
|             serde_json::to_value(&value).expect("CanonicalJsonObj is a valid JsonValue"), |             serde_json::to_value(&value).expect("CanonicalJsonObj is a valid JsonValue"), | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue