Comment on why the auth events are passed separately from the event

This commit is contained in:
Mark Haines 2017-02-09 16:38:45 +00:00
parent 78606ed108
commit ead2a80479
2 changed files with 5 additions and 1 deletions

View file

@ -31,6 +31,10 @@ type InputRoomEvent struct {
// The event JSON for the event to add. // The event JSON for the event to add.
Event []byte Event []byte
// List of state event IDs that authenticate this event. // List of state event IDs that authenticate this event.
// These are likely derived from the "auth_events" JSON key of the event.
// But can be different because the "auth_events" key can be incomplete or wrong.
// For example many matrix events forget to reference the m.room.create event even though it is needed for auth.
// (since synapse allows this to happen we have to allow it as well.)
AuthEventIDs []string AuthEventIDs []string
// Optional list of state event IDs forming the state before this event. // Optional list of state event IDs forming the state before this event.
// These state events must have already been persisted. // These state events must have already been persisted.

View file

@ -31,7 +31,7 @@ func processRoomEvent(db RoomEventDatabase, input api.InputRoomEvent) error {
return err return err
} }
// Check that the event passes authentication checks. // Check that the event passes authentication checks and work out the numeric IDs for the auth events.
authEventNIDs, err := checkAuthEvents(db, event, input.AuthEventIDs) authEventNIDs, err := checkAuthEvents(db, event, input.AuthEventIDs)
if err != nil { if err != nil {
return err return err