Merge branch 'master' into neilalexander/stateresv2

This commit is contained in:
Neil Alexander 2020-03-17 10:40:42 +00:00 committed by GitHub
commit 08479d12cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -116,6 +116,7 @@ func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) {
results[e.EventID()] = gomatrixserverlib.PDUResult{
Error: err.Error(),
}
util.GetLogger(t.context).WithError(err).WithField("event_id", e.EventID()).Warn("Failed to process incoming federation event, skipping it.")
} else {
results[e.EventID()] = gomatrixserverlib.PDUResult{}
}

View file

@ -366,11 +366,16 @@ func (v StateResolutionV1) loadStateAfterEventsForNumericTuples(
// update that key in the result.
// If the requested event wasn't a state event then the state after
// it is the same as the state before it.
set := false
for i := range result {
if result[i].StateKeyTuple == prevState.StateKeyTuple {
result[i] = prevState.StateEntry
set = true
}
}
if !set { // no previous state exists for this event: add new state
result = append(result, prevState.StateEntry)
}
}
return result, nil
}