Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Don't explode
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszradomski committed Feb 8, 2024
1 parent 1e8783f commit 1576182
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class DiscoveryProvider {
(await this.getDeploymentInfo(address)) ?? { blockNumber: 0 } // for cases where API to get deployment info is not available

const maxRange = this.getLogsMaxRange
const allLogs: providers.Log[] = []
let allLogs: providers.Log[] = []

const howManyEvents = options.howManyEvents ?? Infinity
const lowerLimitBlock = Math.max(fromBlock, deploymentBlockNumber)
Expand All @@ -103,11 +103,8 @@ export class DiscoveryProvider {
const start = Math.max(lowerLimitBlock, curBoundaryStart)

const logs = await this.getLogsBatch(address, topics, start, end)
if (options.filter) {
allLogs.unshift(...logs.filter(options.filter))
} else {
allLogs.unshift(...logs)
}
const filtered = options.filter ? logs.filter(options.filter) : logs
allLogs = filtered.concat(allLogs)
end = start - 1

if (allLogs.length >= howManyEvents) {
Expand Down

0 comments on commit 1576182

Please sign in to comment.