Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit 2bd0daf

Browse files
committed
Revert resolving old extremities as well as new
This may no longer be needed with the new state fixes and probably just burns more CPU time than is strictly necessary.
1 parent 70cd8c6 commit 2bd0daf

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

roomserver/internal/input/input_latest_events.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,12 @@ func (u *latestEventsUpdater) latestState() error {
234234
}
235235
}
236236

237-
// Take the old set of extremities and the new set of extremities and
238-
// mash them together into a list. This may or may not include the new event
239-
// from the input path, depending on whether it became a forward extremity
240-
// or not. We'll then run state resolution across all of them to determine
241-
// the new current state of the room. Including the old extremities here
242-
// ensures that new forward extremities with bad state snapshots (from
243-
// possible malicious actors) can't completely corrupt the room state
244-
// away from what it was before.
245-
combinedExtremities := types.StateAtEventAndReferences(append(u.oldLatest, u.latest...))
246-
combinedExtremities = combinedExtremities[:util.SortAndUnique(combinedExtremities)]
247-
latestStateAtEvents := make([]types.StateAtEvent, len(combinedExtremities))
248-
for i := range combinedExtremities {
249-
latestStateAtEvents[i] = combinedExtremities[i].StateAtEvent
237+
// Get a list of the current latest events. This may or may not
238+
// include the new event from the input path, depending on whether
239+
// it is a forward extremity or not.
240+
latestStateAtEvents := make([]types.StateAtEvent, len(u.latest))
241+
for i := range u.latest {
242+
latestStateAtEvents[i] = u.latest[i].StateAtEvent
250243
}
251244

252245
// Takes the NIDs of the latest events and creates a state snapshot

0 commit comments

Comments
 (0)