Skip to content

Commit

Permalink
Problem: check_for_events overflow when the current block is lower th…
Browse files Browse the repository at this point in the history
…an blockdelay (#180)
  • Loading branch information
thomas-nguy authored Dec 13, 2022
1 parent d47e09c commit 9d7001e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion orchestrator/orchestrator/src/ethereum_event_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub async fn check_for_events<S: Signer + 'static, CS: CosmosSigner>(
let prefix = contact.get_prefix();
let our_cosmos_address = cosmos_key.to_address(&prefix).unwrap();
let latest_block = get_block_number_with_retry(eth_client.clone()).await;
let latest_block = latest_block - block_delay;
let latest_block = latest_block.saturating_sub(block_delay);

let mut ending_block = starting_block + blocks_to_search;
if ending_block > latest_block {
Expand Down Expand Up @@ -72,6 +72,8 @@ pub async fn check_for_events<S: Signer + 'static, CS: CosmosSigner>(

let search_range = starting_block..ending_block;

info!("check_for_events from {:?} to {:?}", starting_block, ending_block);

// select uses an inclusive version of the range
erc20_deployed_filter = erc20_deployed_filter.select(search_range.clone());
logic_call_filter = logic_call_filter.select(search_range.clone());
Expand Down

0 comments on commit 9d7001e

Please sign in to comment.