Compare commits

..

2 Commits

Author SHA1 Message Date
0g-peterzhb
ba16e11017
Merge a13717815a into 649f6e5e9f 2024-10-10 16:02:44 +02:00
Joel Liu
649f6e5e9f
Fix the dead loop problem (#228)
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
* Fix the dead loop problem

* keep parent block of log_latest_block_number block

* avoid overflow
2024-10-10 22:02:20 +08:00

View File

@ -178,7 +178,10 @@ impl LogEntryFetcher {
if let Some(finalized_block_number) = finalized_block_number {
let safe_block_number = std::cmp::min(
std::cmp::min(log_latest_block_number, finalized_block_number),
std::cmp::min(
log_latest_block_number.saturating_sub(1),
finalized_block_number,
),
processed_block_number,
);
let mut pending_keys = vec![];
@ -657,7 +660,7 @@ async fn check_watch_process(
);
match provider.get_block(*progress - 1).await {
Ok(Some(v)) => {
v.hash.expect("parent block hash expect exist");
break v.hash.expect("parent block hash expect exist");
}
Ok(None) => {
panic!("parent block {} expect exist", *progress - 1);