diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-06-01 10:09:27 +0100 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-06-01 10:09:27 +0100 |
commit | 02e5c741015300183eff9dcf812174d0efd66c4d (patch) | |
tree | c040534d935abf5fe02fa00cf519d2f85e8e139f /roomserver/internal | |
parent | 70cd8c68c2e562fa8bda6dcf92d7f895c819659d (diff) |
Revert #2457
Squashed commit of the following:
commit 2bd0daf4d61376d2dd56628eaff267b0bc63e116
Author: Neil Alexander <neilalexander@users.noreply.github.com>
Date: Wed Jun 1 09:55:54 2022 +0100
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.
Diffstat (limited to 'roomserver/internal')
-rw-r--r-- | roomserver/internal/input/input_latest_events.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index 59b3fcb1..f772299a 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -234,19 +234,12 @@ func (u *latestEventsUpdater) latestState() error { } } - // Take the old set of extremities and the new set of extremities and - // mash them together into a list. This may or may not include the new event - // from the input path, depending on whether it became a forward extremity - // or not. We'll then run state resolution across all of them to determine - // the new current state of the room. Including the old extremities here - // ensures that new forward extremities with bad state snapshots (from - // possible malicious actors) can't completely corrupt the room state - // away from what it was before. - combinedExtremities := types.StateAtEventAndReferences(append(u.oldLatest, u.latest...)) - combinedExtremities = combinedExtremities[:util.SortAndUnique(combinedExtremities)] - latestStateAtEvents := make([]types.StateAtEvent, len(combinedExtremities)) - for i := range combinedExtremities { - latestStateAtEvents[i] = combinedExtremities[i].StateAtEvent + // Get a list of the current latest events. This may or may not + // include the new event from the input path, depending on whether + // it is a forward extremity or not. + latestStateAtEvents := make([]types.StateAtEvent, len(u.latest)) + for i := range u.latest { + latestStateAtEvents[i] = u.latest[i].StateAtEvent } // Takes the NIDs of the latest events and creates a state snapshot |