Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Dec 15, 2024
1 parent 3d48766 commit 0d17b17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 2 additions & 8 deletions authstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ func checkAllowedByAuthEvents(
event PDU, eventsByID map[string]PDU,
missingAuth EventProvider, userIDForSender spec.UserIDForSender,
) error {
authEvents, err := NewAuthEvents(nil)
if err != nil {
return err
}
authEvents, _ := NewAuthEvents(nil)

for _, ae := range event.AuthEventIDs() {
retryEvent:
Expand Down Expand Up @@ -338,10 +335,7 @@ func CheckSendJoinResponse(
}

eventsByID := map[string]PDU{}
authEventProvider, err := NewAuthEvents(nil)
if err != nil {
return nil, err
}
authEventProvider, _ := NewAuthEvents(nil)

// Since checkAllowedByAuthEvents needs to be able to look up any of the
// auth events by ID only, we will build a map which contains references
Expand Down
8 changes: 5 additions & 3 deletions stateresolutionv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,12 @@ func (r *stateResolverV2) getFirstPowerLevelMainlineEvent(event PDU) (
func (r *stateResolverV2) authAndApplyEvents(events ...PDU) {
addFromAuthEventsIfNotRejected := func(event PDU, eventType, stateKey string) {
for _, authEventID := range event.AuthEventIDs() {
if _, ok := r.isRejectedCache[authEventID]; !ok {
r.isRejectedCache[authEventID] = r.isRejectedFn(authEventID)
rejected, ok := r.isRejectedCache[authEventID]
if !ok {
rejected = r.isRejectedFn(authEventID)
r.isRejectedCache[authEventID] = rejected
}
if rejected := r.isRejectedCache[authEventID]; rejected {
if rejected {
continue
}
authEv, ok := r.authEventMap[authEventID]
Expand Down

0 comments on commit 0d17b17

Please sign in to comment.