From 473c83bbcdb9e55243970f65a6e906105d49ffe8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 23 Sep 2021 15:15:18 +0200 Subject: [PATCH] make sure fromBlock and toBlockare used while querying --- libs/remix-lib/src/execution/logsManager.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/remix-lib/src/execution/logsManager.ts b/libs/remix-lib/src/execution/logsManager.ts index 6420d53028..39705e7342 100644 --- a/libs/remix-lib/src/execution/logsManager.ts +++ b/libs/remix-lib/src/execution/logsManager.ts @@ -55,11 +55,10 @@ export class LogsManager { if (queryFilter.topics.filter((logTopic) => changeEvent.log.topics.indexOf(logTopic) >= 0).length === 0) return false if (queryType === 'logs') { - + const fromBlock = queryFilter.fromBlock || '0x0' + const toBlock = queryFilter.toBlock || this.oldLogs.length ? this.oldLogs[this.oldLogs.length - 1].blockNumber : '0x0' if ((queryFilter.address === (changeEvent.tx.to || '').toString()) || queryFilter.address === (changeEvent.tx.getSenderAddress().toString())) { - if (!queryFilter.toBlock) { - return true - } else if (parseInt(queryFilter.toBlock) >= parseInt(changeEvent.blockNumber)) { + if ((parseInt(toBlock) >= parseInt(changeEvent.blockNumber)) && (parseInt(fromBlock) <= parseInt(changeEvent.blockNumber))) { return true } }