Skip to content

Commit c1fdd2d

Browse files
authored
fix(coprocessor): host-listener, restart on last validated block on disconnect (#1525)
1 parent 806011a commit c1fdd2d

File tree

1 file changed

+11
-2
lines changed
  • coprocessor/fhevm-engine/host-listener/src/cmd

1 file changed

+11
-2
lines changed

coprocessor/fhevm-engine/host-listener/src/cmd/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,15 +1045,24 @@ pub async fn main(args: Args) -> anyhow::Result<()> {
10451045
if args.only_catchup_loop && !block_logs.catchup {
10461046
break;
10471047
}
1048-
let _ = db_insert_block(
1048+
let status = db_insert_block(
10491049
chain_id,
10501050
&mut db,
10511051
&block_logs,
10521052
&acl_contract_address,
10531053
&tfhe_contract_address,
10541054
)
10551055
.await;
1056-
// logging & retry on error is already done in db_insert_block
1056+
if status.is_err() {
1057+
// logging & retry on error is already done in db_insert_block
1058+
continue;
1059+
};
1060+
log_iter.last_valid_block = Some(
1061+
block_logs
1062+
.summary
1063+
.number
1064+
.max(log_iter.last_valid_block.unwrap_or(0)),
1065+
);
10571066
}
10581067

10591068
if !args.only_catchup_loop {

0 commit comments

Comments
 (0)