From 0205f9ede337e5574245b45e1ee940b8ace89456 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 9 Nov 2017 23:16:26 -0500 Subject: Simplify to/from block code --- src/order_watcher/event_watcher.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/order_watcher/event_watcher.ts b/src/order_watcher/event_watcher.ts index 786470f1d..2a1b6dacf 100644 --- a/src/order_watcher/event_watcher.ts +++ b/src/order_watcher/event_watcher.ts @@ -53,19 +53,16 @@ export class EventWatcher { this._lastEvents = pendingEvents; } private async _getEventsAsync(): Promise { - let fromBlock: BlockParamLiteral|number; - let toBlock: BlockParamLiteral|number; + let latestBlock: BlockParamLiteral|number; if (this._numConfirmations === 0) { - fromBlock = BlockParamLiteral.Pending; - toBlock = fromBlock; + latestBlock = BlockParamLiteral.Pending; } else { const currentBlock = await this._web3Wrapper.getBlockNumberAsync(); - toBlock = currentBlock - this._numConfirmations; - fromBlock = toBlock; + latestBlock = currentBlock - this._numConfirmations; } const eventFilter = { - fromBlock, - toBlock, + fromBlock: latestBlock, + toBlock: latestBlock, }; const events = await this._web3Wrapper.getLogsAsync(eventFilter); return events; -- cgit v1.2.3