Skip to content

Commit

Permalink
Revert "fix: get_logs_paginated fetches past latest block (gakonst#1818
Browse files Browse the repository at this point in the history
…)" (gakonst#1845)

This reverts commit eb40392.
  • Loading branch information
gakonst authored and hexiaoyuan committed Nov 9, 2022
1 parent 01a9c67 commit 348dec1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
- [#1632](https://github.com/gakonst/ethers-rs/pull/1632) Re-export `H32` from `ethabi`.
- [#1634](https://github.com/gakonst/ethers-rs/pull/1634) Derive missing `Clone`, `Copy` and `Debug` impls in ethers-etherscan.
- Bytes debug format now displays hex literals [#1658](https://github.com/gakonst/ethers-rs/pull/1658)
- Fix `get_logs_paginated` trying to fetch beyond the latest block

## ethers-contract-abigen

Expand Down
4 changes: 2 additions & 2 deletions ethers-providers/src/log_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ where
// this is okay because we will only enter this state when the filter is
// paginatable i.e. from block is set
let from_block = self.filter.get_from_block().unwrap();
let to_block = std::cmp::min(from_block + self.page_size, last_block);
let to_block = from_block + self.page_size;
self.from_block = Some(to_block + 1);

let filter = self.filter.clone().from_block(from_block).to_block(to_block);
Expand Down Expand Up @@ -122,7 +122,7 @@ where
// load new logs if there are still more pages to go through
// can safely assume this will always be set in this state
let from_block = self.from_block.unwrap();
let to_block = std::cmp::min(from_block + self.page_size, self.last_block.unwrap());
let to_block = from_block + self.page_size;

// no more pages to load, and everything is consumed
// can safely assume this will always be set in this state
Expand Down
21 changes: 0 additions & 21 deletions ethers-providers/tests/log_query.rs

This file was deleted.

0 comments on commit 348dec1

Please sign in to comment.