Skip to content

Commit

Permalink
Ignore invalid events in redux.
Browse files Browse the repository at this point in the history
  • Loading branch information
chmac committed Nov 25, 2024
1 parent 28723c4 commit 72c5508
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nr-app/src/redux/slices/events.slice.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ID_SEPARATOR } from "@/constants";
import { Event } from "@common/mod";
import { Event, isValidEvent } from "@common/mod";
import {
createEntityAdapter,
createSlice,
Expand Down Expand Up @@ -75,6 +75,12 @@ export const eventsSlice = createSlice({
action: PayloadAction<{ event: Event; fromRelay: string }>,
) => {
const { event, fromRelay: seenOnRelay } = action.payload;

// Skip events which don't pass validation
if (!isValidEvent(event)) {
return;
}

const storageId = getStorageId(event);

const eventWithMetadata = {
Expand Down

0 comments on commit 72c5508

Please sign in to comment.