mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-31 18:53:10 -06:00
Tweak MissingAuthPrevEvents
This commit is contained in:
parent
52581e467a
commit
2c92171988
|
|
@ -677,8 +677,12 @@ func (d *Database) GetPublishedRooms(ctx context.Context) ([]string, error) {
|
||||||
func (d *Database) MissingAuthPrevEvents(
|
func (d *Database) MissingAuthPrevEvents(
|
||||||
ctx context.Context, e *gomatrixserverlib.Event,
|
ctx context.Context, e *gomatrixserverlib.Event,
|
||||||
) (missingAuth, missingPrev []string, err error) {
|
) (missingAuth, missingPrev []string, err error) {
|
||||||
|
authEventNIDs, err := d.EventNIDs(ctx, e.AuthEventIDs())
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("d.EventNIDs: %w", err)
|
||||||
|
}
|
||||||
for _, authEventID := range e.AuthEventIDs() {
|
for _, authEventID := range e.AuthEventIDs() {
|
||||||
if nids, err := d.EventNIDs(ctx, []string{authEventID}); err != nil || len(nids) == 0 {
|
if _, ok := authEventNIDs[authEventID]; !ok {
|
||||||
missingAuth = append(missingAuth, authEventID)
|
missingAuth = append(missingAuth, authEventID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue