Fix get_closest_parent and cleanup federation/send/:txn

This commit is contained in:
Devin Ragotzy 2020-11-08 13:54:59 -05:00 committed by Timo Kösters
parent b13049a6fa
commit acd144e934
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
6 changed files with 69 additions and 334 deletions

View file

@ -405,11 +405,12 @@ impl Rooms {
pub fn get_closest_parent(
&self,
room: &RoomId,
incoming_prev_ids: &[EventId],
their_state: &BTreeMap<EventId, Arc<StateEvent>>,
) -> Result<Option<ClosestParent>> {
match self.pduid_pdu.last()? {
Some(val)
match self.pduid_pdu.scan_prefix(room.as_bytes()).last() {
Some(Ok(val))
if incoming_prev_ids.contains(
&serde_json::from_slice::<PduEvent>(&val.1)
.map_err(|_| {