Skip to content

Commit 945e8df

Browse files
committed
Fix
1 parent 78d2987 commit 945e8df

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

bin/snoop.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,17 @@ async fn sync_chain(rpc: &Rpc, db: &Database, config: &Config) {
6969
let first_block = block_chunk[0];
7070
let last_block = block_chunk[block_chunk.len() - 1];
7171

72-
let pair_logs = rpc
72+
let pair_logs = match rpc
7373
.get_factory_logs_batch(
7474
first_block as u64,
7575
last_block as u64,
7676
config,
7777
)
78-
.await;
78+
.await
79+
{
80+
Some(logs) => logs,
81+
None => return,
82+
};
7983

8084
handle_pairs(pair_logs, db, rpc).await;
8185

src/rpc/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ impl Rpc {
6161
first_block: u64,
6262
last_block: u64,
6363
config: &Config,
64-
) -> Vec<Log> {
64+
) -> Option<Vec<Log>> {
6565
let filter = Filter::new()
6666
.from_block(BlockNumberOrTag::Number(first_block))
6767
.to_block(BlockNumberOrTag::Number(last_block))
6868
.address(config.factory.address)
6969
.event(PairCreated::SIGNATURE);
7070

71-
self.client
72-
.get_logs(&filter)
73-
.await
74-
.expect("unable to get logs from RPC")
71+
match self.client.get_logs(&filter).await {
72+
Ok(logs) => logs,
73+
Err(_) => None,
74+
}
7575
}
7676

7777
pub async fn get_pairs_logs_batch(

0 commit comments

Comments
 (0)