Harmony backports (#3581)

Backport a few things from Harmony.

### Pull Request Checklist

<!-- Please read
https://matrix-org.github.io/dendrite/development/contributing before
submitting your pull request -->

* [ ] I have added Go unit tests or [Complement integration
tests](https://github.com/matrix-org/complement) for this PR _or_ I have
justified why this PR doesn't need tests
* [x] Pull request includes a [sign off
below](https://element-hq.github.io/dendrite/development/contributing#sign-off)
_or_ I have already signed off privately

---------

Signed-off-by: Till Faelligen <2353100+S7evinK@users.noreply.github.com>
Co-authored-by: Kegan Dougal <7190048+kegsay@users.noreply.github.com>
This commit is contained in:
Till 2025-06-19 09:49:03 +02:00 committed by GitHub
parent c133596baf
commit 331a6f221b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 11 deletions

View file

@ -13,7 +13,7 @@ import (
"errors"
"fmt"
//"github.com/element-hq/dendrite/roomserver/internal"
// "github.com/element-hq/dendrite/roomserver/internal"
"github.com/element-hq/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
@ -747,7 +747,7 @@ func GetAuthChain(
// from the database and the `eventsToFetch` will be updated with any new
// events that we have learned about and need to find. When `eventsToFetch`
// is eventually empty, we should have reached the end of the chain.
eventsToFetch := authEventIDs
eventsToFetch := append([]string{}, authEventIDs...)
authEventsMap := make(map[string]gomatrixserverlib.PDU)
for len(eventsToFetch) > 0 {
@ -779,7 +779,7 @@ func GetAuthChain(
// We've now retrieved all of the events we can. Flatten them down into an
// array and return them.
var authEvents []gomatrixserverlib.PDU
authEvents := make([]gomatrixserverlib.PDU, 0, len(authEventsMap))
for _, event := range authEventsMap {
authEvents = append(authEvents, event)
}