|
|
|
@ -870,21 +870,6 @@ pub async fn send_transaction_message_route<'a>( |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if !state_res::event_auth::auth_check( |
|
|
|
|
|
|
|
&RoomVersionId::Version6, |
|
|
|
|
|
|
|
&pdu, |
|
|
|
|
|
|
|
single_prev, |
|
|
|
|
|
|
|
&state_at_forks, |
|
|
|
|
|
|
|
None, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.map_err(|_e| Error::Conflict("Auth check failed"))? |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Soft fail, we add the event as an outlier.
|
|
|
|
|
|
|
|
resolved_map.insert( |
|
|
|
|
|
|
|
pdu.event_id().clone(), |
|
|
|
|
|
|
|
Err("Event has been soft failed".into()), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Add the event to the DB and update the forward extremities (via roomid_pduleaves).
|
|
|
|
// Add the event to the DB and update the forward extremities (via roomid_pduleaves).
|
|
|
|
append_incoming_pdu( |
|
|
|
append_incoming_pdu( |
|
|
|
&db, |
|
|
|
&db, |
|
|
|
@ -900,7 +885,6 @@ pub async fn send_transaction_message_route<'a>( |
|
|
|
// Event has passed all auth/stateres checks
|
|
|
|
// Event has passed all auth/stateres checks
|
|
|
|
resolved_map.insert(pdu.event_id().clone(), Ok(())); |
|
|
|
resolved_map.insert(pdu.event_id().clone(), Ok(())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(send_transaction_message::v1::Response { pdus: resolved_map }.into()) |
|
|
|
Ok(send_transaction_message::v1::Response { pdus: resolved_map }.into()) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1210,8 +1194,7 @@ async fn calculate_forward_extremities( |
|
|
|
/// Update the room state to be the resolved state and add the fully auth'ed event
|
|
|
|
/// Update the room state to be the resolved state and add the fully auth'ed event
|
|
|
|
/// to the DB.
|
|
|
|
/// to the DB.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// TODO: If we force the state we need to validate all events in that state
|
|
|
|
/// TODO: Since all these events passed state resolution can we trust them to add
|
|
|
|
/// any events we fetched from another server need to be fully verified?
|
|
|
|
|
|
|
|
fn append_incoming_pdu( |
|
|
|
fn append_incoming_pdu( |
|
|
|
db: &Database, |
|
|
|
db: &Database, |
|
|
|
pdu: &PduEvent, |
|
|
|
pdu: &PduEvent, |
|
|
|
|