Skip to content

Commit

Permalink
[EDEX-26] fix getLogs fromBlock calculating
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Borsuk committed Nov 20, 2019
1 parent 8c2a4ab commit 7777ba3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "echo-web3",
"version": "0.1.3",
"version": "0.1.4",
"description": "The wrapper over the Web3 that helps you to save your DAPP's code with calling to web3 methods by call to ECHO blockchain",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
Expand Down
10 changes: 6 additions & 4 deletions src/providers/methods/get-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ class GetLogs extends Method {
toBlock = Number(toBlock) || latestBlock;
}

// NOTE:: echo chain interpreters `[fromBlock, toBlock]` is empty range, if fromBlock === toBlock
// we need to decrease left side of range for getting of toBlock's logs
// according with this behaviour we need to decrease fromBlock every time
fromBlock -=1;
if(fromBlock !== 1){
// NOTE:: echo chain interpreters `[fromBlock, toBlock]` is empty range, if fromBlock === toBlock
// we need to decrease left side of range for getting of toBlock's logs
// according with this behaviour we need to decrease fromBlock every time
fromBlock -= 1;
}

if (toBlock < fromBlock) throw new Error('toBlock is less than fromBlock');

Expand Down

0 comments on commit 7777ba3

Please sign in to comment.