@@ -9,6 +9,7 @@ use serde_json;
99use slot_clock:: { SlotClock , SystemTimeSlotClock } ;
1010use std:: path:: PathBuf ;
1111use std:: time:: Duration ;
12+ use tokio:: time:: sleep;
1213use types:: { ChainSpec , EthSpec , PublicKeyBytes } ;
1314// use validator_http_api::create_signed_voluntary_exit::get_current_epoch;
1415
@@ -70,7 +71,7 @@ pub fn cli_app() -> Command {
7071 . long ( SIGNATURE_FLAG )
7172 . help ( "Display the signature of the voluntary exit." )
7273 . help_heading ( FLAG_HEADER )
73- . action ( ArgAction :: Set )
74+ . action ( ArgAction :: SetTrue )
7475 . display_order ( 0 ) ,
7576 )
7677}
@@ -227,7 +228,7 @@ async fn run<E: EthSpec>(config: ExitConfig) -> Result<(), String> {
227228 && current_epoch < activation_epoch + spec. shard_committee_period
228229 {
229230 eprintln ! (
230- "Validator {} is not eligible for exit. It will become eligible on epoch {}" ,
231+ "Validator {} is not eligible for exit. It will become eligible at epoch {}" ,
231232 validator_to_exit,
232233 activation_epoch + spec. shard_committee_period
233234 )
@@ -236,17 +237,20 @@ async fn run<E: EthSpec>(config: ExitConfig) -> Result<(), String> {
236237 "Validator {} is not eligible for exit. Validator status is: {:?}" ,
237238 validator_to_exit, validator_data. status
238239 )
239- } ;
240+ } else {
241+ // Only publish voluntary exit if validator is ActiveOngoing
242+ beacon_node
243+ . post_beacon_pool_voluntary_exits ( & exit_message. data )
244+ . await
245+ . map_err ( |e| format ! ( "Failed to publish voluntary exit: {}" , e) ) ?;
246+ // tokio::time::sleep(std::time::Duration::from_secs(1)).await; // Provides nicer UX.
247+ eprintln ! (
248+ "Successfully validated and published voluntary exit for validator {}" ,
249+ validator_to_exit
250+ ) ;
251+ }
240252
241- beacon_node
242- . post_beacon_pool_voluntary_exits ( & exit_message. data )
243- . await
244- . map_err ( |e| format ! ( "Failed to publish voluntary exit: {}" , e) ) ?;
245- // tokio::time::sleep(std::time::Duration::from_secs(1)).await; // Provides nicer UX.
246- eprintln ! (
247- "Successfully validated and published voluntary exit for validator {}" ,
248- validator_to_exit
249- ) ;
253+ sleep ( Duration :: from_secs ( spec. seconds_per_slot ) ) . await ;
250254
251255 // Check validator status after publishing voluntary exit
252256 match validator_data. status {
0 commit comments