1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-27 02:08:31 +00:00

Add suggested assertations to prevent potentially broken extremities

This commit is contained in:
nexy7574 2025-06-19 13:46:52 +01:00
parent 51185daca2
commit 6947b75f6e
No known key found for this signature in database
GPG key ID: 0FA334385D0B689F
2 changed files with 3 additions and 1 deletions

View file

@ -215,6 +215,7 @@ pub(super) async fn upgrade_outlier_to_timeline_pdu(
// if not soft fail it
if soft_fail {
info!("Soft failing event {}", incoming_pdu.event_id);
assert!(extremities.is_empty(), "soft_fail extremities empty");
let extremities = extremities.iter().map(Borrow::borrow);
self.services

View file

@ -976,8 +976,9 @@ impl Service {
state_lock: &'a RoomMutexGuard,
) -> Result<Option<RawPduId>>
where
Leaves: Iterator<Item = &'a EventId> + Send + 'a,
Leaves: Iterator<Item = &'a EventId> + Send + Clone + 'a,
{
assert!(new_room_leaves.clone().count() > 0, "extremities are empty");
// We append to state before appending the pdu, so we don't have a moment in
// time with the pdu without it's state. This is okay because append_pdu can't
// fail.