Fix filters by forcing a poll instantly when polling starts to capture the current block (#613).

This commit is contained in:
Richard Moore 2019-10-30 19:13:32 +09:00
parent b3f5266e78
commit d0e0e30532
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -666,6 +666,7 @@ export class BaseProvider extends Provider {
toBlock: blockNumber,
topics: topics
}
if (!filter.address) { delete filter.address; }
this.getLogs(filter).then((logs) => {
if (logs.length === 0) { return; }
@ -716,6 +717,7 @@ export class BaseProvider extends Provider {
setTimeout(() => {
if (value && !this._poller) {
this._poller = setInterval(this._doPoll.bind(this), this.pollingInterval);
this._doPoll();
} else if (!value && this._poller) {
clearInterval(this._poller);