Skip to content

Commit 97bddf8

Browse files
committed
update validator data
1 parent ba45cc5 commit 97bddf8

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

validator_manager/src/exit_validators.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub fn cli_app() -> Command {
6767
.value_name("EPOCH")
6868
.help("Provide the minimum epoch for processing voluntary exit.")
6969
.action(ArgAction::Set)
70+
.requires(SIGNATURE_FLAG)
7071
.display_order(0),
7172
)
7273
.arg(
@@ -250,14 +251,28 @@ async fn run<E: EthSpec>(config: ExitConfig) -> Result<(), String> {
250251
);
251252
}
252253

253-
// Sleep a constant 12s as in testnet 3s would be too short for validator status to update
254-
sleep(Duration::from_secs(12)).await;
254+
sleep(Duration::from_secs(spec.seconds_per_slot)).await;
255255

256256
// Check validator status after publishing voluntary exit
257-
match validator_data.status {
257+
let updated_validator_data = beacon_node
258+
.get_beacon_states_validator_id(
259+
StateId::Head,
260+
&ValidatorId::PublicKey(validator_to_exit),
261+
)
262+
.await
263+
.map_err(|e| format!("Failed to get updated validator details: {:?}", e))?
264+
.ok_or_else(|| {
265+
format!(
266+
"Validator {} is not present in the beacon state",
267+
validator_to_exit
268+
)
269+
})?
270+
.data;
271+
272+
match updated_validator_data.status {
258273
ValidatorStatus::ActiveExiting => {
259-
let exit_epoch = validator_data.validator.exit_epoch;
260-
let withdrawal_epoch = validator_data.validator.withdrawable_epoch;
274+
let exit_epoch = updated_validator_data.validator.exit_epoch;
275+
let withdrawal_epoch = updated_validator_data.validator.withdrawable_epoch;
261276

262277
eprintln!("Voluntary exit has been accepted into the beacon chain, but not yet finalized. \
263278
Finalization may take several minutes or longer. Before finalization there is a low \

0 commit comments

Comments
 (0)