Resolved state is set as the current room state on incoming events
parent
35c1904b37
commit
894b6ef037
|
@ -870,36 +870,20 @@ pub async fn send_transaction_message_route<'a>(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if !state_res::event_auth::auth_check(
|
// Add the event to the DB and update the forward extremities (via roomid_pduleaves).
|
||||||
&RoomVersionId::Version6,
|
append_incoming_pdu(
|
||||||
|
&db,
|
||||||
&pdu,
|
&pdu,
|
||||||
single_prev,
|
&extremities,
|
||||||
&state_at_forks,
|
if update_state {
|
||||||
None,
|
Some(state_at_forks)
|
||||||
)
|
} else {
|
||||||
.map_err(|_e| Error::Conflict("Auth check failed"))?
|
None
|
||||||
{
|
},
|
||||||
// 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).
|
|
||||||
append_incoming_pdu(
|
|
||||||
&db,
|
|
||||||
&pdu,
|
|
||||||
&extremities,
|
|
||||||
if update_state {
|
|
||||||
Some(state_at_forks)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
},
|
|
||||||
)?;
|
|
||||||
|
|
||||||
// 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,
|
||||||
|
|
Loading…
Reference in New Issue