@@ -341,9 +341,14 @@ struct BeaconNodeOptions {
341341 #[ clap( long) ]
342342 jwt_version : Option < String > ,
343343
344- /// Enable syncing historical data
344+ /// [DEPRECATED] Enable syncing historical data
345345 /// [default: disabled]
346346 #[ clap( long = "back_sync" ) ]
347+ back_sync : bool ,
348+
349+ /// Enable syncing historical data
350+ /// [default: disabled]
351+ #[ clap( long = "back-sync" ) ]
347352 back_sync_enabled : bool ,
348353
349354 /// Collect Prometheus metrics
@@ -908,7 +913,8 @@ impl GrandineArgs {
908913 jwt_id,
909914 jwt_secret,
910915 jwt_version,
911- back_sync_enabled,
916+ back_sync,
917+ mut back_sync_enabled,
912918 metrics_enabled,
913919 metrics_address,
914920 metrics_port,
@@ -1200,6 +1206,11 @@ impl GrandineArgs {
12001206 version : jwt_version,
12011207 } ;
12021208
1209+ if back_sync {
1210+ warn ! ( "--back_sync option is deprecated. Use --back-sync instead." ) ;
1211+ back_sync_enabled = true ;
1212+ }
1213+
12031214 let builder_url = if builder_url. is_none ( ) && builder_api_url. is_some ( ) {
12041215 warn ! ( "--builder-api-url option is deprecated. Use --builder-url instead." ) ;
12051216 builder_api_url
@@ -1503,6 +1514,24 @@ mod tests {
15031514 ) ;
15041515 }
15051516
1517+ #[ test]
1518+ fn back_sync_disabled_by_default ( ) {
1519+ let config = config_from_args ( [ ] ) ;
1520+ assert ! ( !config. back_sync_enabled) ;
1521+ }
1522+
1523+ #[ test]
1524+ fn supports_back_sync_flag ( ) {
1525+ let config = config_from_args ( [ "--back-sync" ] ) ;
1526+ assert ! ( config. back_sync_enabled) ;
1527+ }
1528+
1529+ #[ test]
1530+ fn supports_deprecated_back_sync_flag ( ) {
1531+ let config = config_from_args ( [ "--back_sync" ] ) ;
1532+ assert ! ( config. back_sync_enabled) ;
1533+ }
1534+
15061535 #[ test]
15071536 fn eth1_rpc_urls_single_value ( ) {
15081537 let config = config_from_args ( [ "--eth1-rpc-urls" , "http://localhost:8545" ] ) ;
0 commit comments