Don't fail an entire request if one of the returned events fails a signature check. If an event does fail a signature check, look in the local database and request it from the originator.

This commit is contained in:
Erik Johnston 2015-02-02 16:56:01 +00:00
parent 365e007bee
commit 941f59101b
2 changed files with 94 additions and 34 deletions

View file

@ -128,16 +128,21 @@ class DataStore(RoomMemberStore, RoomStore,
pass
@defer.inlineCallbacks
def get_event(self, event_id, allow_none=False):
events = yield self._get_events([event_id])
def get_event(self, event_id, check_redacted=True,
get_prev_content=False, allow_rejected=False,
allow_none=False):
event = yield self.runInteraction(
"get_event", self._get_event_txn,
event_id,
check_redacted=check_redacted,
get_prev_content=get_prev_content,
allow_rejected=allow_rejected,
)
if not events:
if allow_none:
defer.returnValue(None)
else:
raise RuntimeError("Could not find event %s" % (event_id,))
if not event and not allow_none:
raise RuntimeError("Could not find event %s" % (event_id,))
defer.returnValue(events[0])
defer.returnValue(event)
@log_function
def _persist_event_txn(self, txn, event, context, backfilled,