swap routers back to default, print error on app store state deserialize

This commit is contained in:
dr-frmr 2024-05-31 15:59:05 -06:00
parent 598b1d2d24
commit 6f67f9b8f6
No known key found for this signature in database
2 changed files with 14 additions and 14 deletions

View File

@ -56,17 +56,18 @@ impl OnchainMetadata {
/// fetch state from disk or create a new one if that fails
pub fn fetch_state(our: Address, provider: eth::Provider) -> State {
if let Some(state_bytes) = get_state() {
if let Ok(state) = serde_json::from_slice::<SerializedState>(&state_bytes) {
if state.contract_address == CONTRACT_ADDRESS {
return State::from_serialized(our, provider, state);
} else {
println!(
"state contract address mismatch! expected {}, got {}",
CONTRACT_ADDRESS, state.contract_address
);
match serde_json::from_slice::<SerializedState>(&state_bytes) {
Ok(state) => {
if state.contract_address == CONTRACT_ADDRESS {
return State::from_serialized(our, provider, state);
} else {
println!(
"state contract address mismatch! expected {}, got {}",
CONTRACT_ADDRESS, state.contract_address
);
}
}
} else {
println!("failed to deserialize saved state");
Err(e) => println!("failed to deserialize saved state: {e}"),
}
}
State::new(our, provider, CONTRACT_ADDRESS.to_string()).expect("state creation failed")

View File

@ -73,10 +73,9 @@ pub async fn register(
("tcp".to_string(), tcp_port),
]),
routers: vec![
// "default-router-1.os".into(),
// "default-router-2.os".into(),
// "default-router-3.os".into(),
"default-router-7.os".into(),
"default-router-1.os".into(),
"default-router-2.os".into(),
"default-router-3.os".into(),
],
},
});