File tree Expand file tree Collapse file tree
aggregation_mode/src/backend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,11 +33,18 @@ impl Config {
3333 }
3434
3535 pub fn get_last_processed_block ( & self ) -> Result < u64 , Box < dyn std:: error:: Error > > {
36- let mut file = File :: open ( & self . last_processed_block_filepath ) ?;
37- let mut contents = String :: new ( ) ;
38- file. read_to_string ( & mut contents) ?;
39- let lpb: LastProcessedBlock = serde_json:: from_str ( & contents) ?;
40- Ok ( lpb. last_processed_block )
36+ match File :: open ( & self . last_processed_block_filepath ) {
37+ Err ( _) =>{
38+ // if file doesn't exist, default 0
39+ Ok ( 0 )
40+ }
41+ Ok ( mut file) => {
42+ let mut contents = String :: new ( ) ;
43+ file. read_to_string ( & mut contents) ?;
44+ let lpb: LastProcessedBlock = serde_json:: from_str ( & contents) ?;
45+ Ok ( lpb. last_processed_block )
46+ }
47+ }
4148 }
4249
4350 pub fn update_last_processed_block (
@@ -51,6 +58,7 @@ impl Config {
5158 let mut file = OpenOptions :: new ( )
5259 . write ( true )
5360 . truncate ( true )
61+ . create ( true )
5462 . open ( & self . last_processed_block_filepath ) ?;
5563
5664 let content = serde_json:: to_string ( & last_processed_block_struct) ?;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ eth_ws_url: ws://localhost:8545
33max_proofs_in_queue : 1000
44proof_aggregation_service_address : 0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07
55aligned_service_manager_address : 0x851356ae760d987E095750cCeb3bC6014560891C
6- last_processed_block_filepath : config-files/proof-aggregator .last_processed_block.json
6+ last_processed_block_filepath : config-files/proof-aggregator2 .last_processed_block.json
77ecdsa :
88 private_key_store_path : config-files/anvil.proof-aggregator.ecdsa.key.json
99 private_key_store_password : ' '
Original file line number Diff line number Diff line change 1- {"last_processed_block" :1305 }
1+ {"last_processed_block" :1346 }
You can’t perform that action at this time.
0 commit comments