Skip to content

Commit

Permalink
Merge pull request #2 from zero-gravity-labs/filter_address
Browse files Browse the repository at this point in the history
Filter address in log sync.
  • Loading branch information
peilun-conflux authored Jan 19, 2024
2 parents 9b4b043 + a26cef4 commit 877f484
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 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 @@ -71,6 +71,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 @@ -116,7 +117,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 @@ -143,6 +144,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 @@ -160,7 +162,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
2 changes: 1 addition & 1 deletion zerog-storage-client

0 comments on commit 877f484

Please sign in to comment.