Skip to content

Commit ef00542

Browse files
committed
fix: apply activate/deactivate locally when broadcasting from RPC
The validator wasn't applying activate/deactivate changes locally, only broadcasting them to P2P. Now these operations are applied locally and persisted immediately.
1 parent f7e6828 commit ef00542

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bins/validator-node/src/main.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,24 @@ async fn main() -> Result<()> {
12561256
);
12571257
}
12581258
}
1259+
} else if update_type == "activate" {
1260+
// Handle activate action locally
1261+
mutate_and_persist(storage.clone(), chain_state.clone(), "activate_local", |cs| {
1262+
cs.set_challenge_active(&challenge_id, true);
1263+
}).await;
1264+
state_manager.apply(|state| {
1265+
state.set_challenge_active(&challenge_id, true);
1266+
});
1267+
info!(challenge_id = %challenge_id, "Challenge activated locally");
1268+
} else if update_type == "deactivate" {
1269+
// Handle deactivate action locally
1270+
mutate_and_persist(storage.clone(), chain_state.clone(), "deactivate_local", |cs| {
1271+
cs.set_challenge_active(&challenge_id, false);
1272+
}).await;
1273+
state_manager.apply(|state| {
1274+
state.set_challenge_active(&challenge_id, false);
1275+
});
1276+
info!(challenge_id = %challenge_id, "Challenge deactivated locally");
12591277
}
12601278
}
12611279
}

0 commit comments

Comments
 (0)