Skip to content

Commit 33b141b

Browse files
committed
refactored getEventsInBlockRange
1 parent a32a957 commit 33b141b

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

lib/rsk-utils.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -593,18 +593,10 @@ const findEventInBlock = async (rskTxHelper, eventName, fromBlockNumber, toBlock
593593
);
594594
for (let i = 0; i < bridgeTransactions.length; i++) {
595595
const tx = bridgeTransactions[i];
596-
const event = tx.events.find((event) => {
597-
return event.name === eventName;
598-
});
599-
if (event) {
600-
if (check) {
601-
const found = await check(event, tx);
602-
if (!found) {
603-
continue;
604-
}
605-
}
606-
return event;
607-
}
596+
const event = tx.events.find((event) => event.name === eventName);
597+
if (!event) continue;
598+
if (check && !(await check(event, tx))) continue;
599+
return event;
608600
}
609601
}
610602
return null;

0 commit comments

Comments
 (0)