Skip to content

Commit

Permalink
fix: filter log by address
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniFrenchBread committed Jan 19, 2024
1 parent 5198c1f commit 5fe390f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions node/log_entry_sync/src/sync_manager/log_entry_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl LogEntryFetcher {
.submit_filter()
.from_block(progress)
.to_block(end_block_number)
.address(contract.address().into())
.filter;
let mut stream = LogQuery::new(&provider, &filter, log_query_delay)
.with_page_size(log_page_size);
Expand Down Expand Up @@ -123,7 +124,7 @@ impl LogEntryFetcher {
}
Err(e) => {
error!("log query error: e={:?}", e);
filter = filter.from_block(progress);
filter = filter.from_block(progress).address(contract.address());
stream = LogQuery::new(&provider, &filter, log_query_delay)
.with_page_size(log_page_size);
tokio::time::sleep(Duration::from_millis(RETRY_WAIT_MS)).await;
Expand All @@ -150,6 +151,7 @@ impl LogEntryFetcher {
let mut filter = contract
.submit_filter()
.from_block(start_block_number)
.address(contract.address().into())
.filter;
debug!("start_watch starts, start={}", start_block_number);
let mut filter_id =
Expand All @@ -167,7 +169,7 @@ impl LogEntryFetcher {
{
Err(e) => {
error!("log sync watch error: e={:?}", e);
filter = filter.from_block(progress);
filter = filter.from_block(progress).address(contract.address());
filter_id = repeat_run_and_log(|| {
provider.new_filter(FilterKind::Logs(&filter))
})
Expand Down

0 comments on commit 5fe390f

Please sign in to comment.