@@ -535,6 +535,7 @@ async fn main() -> Result<()> {
535535
536536 let netuid = args. netuid ;
537537 let version_key = args. version_key ;
538+ let is_bootnode = args. bootnode ;
538539 let mut heartbeat_interval = tokio:: time:: interval ( Duration :: from_secs ( 30 ) ) ;
539540 let mut metagraph_interval = tokio:: time:: interval ( Duration :: from_secs ( 300 ) ) ;
540541 let mut stale_check_interval = tokio:: time:: interval ( Duration :: from_secs ( 60 ) ) ;
@@ -579,33 +580,35 @@ async fn main() -> Result<()> {
579580 ) . await ;
580581 }
581582
582- // Heartbeat - broadcast to other validators
583+ // Heartbeat - broadcast to other validators (skip in bootnode mode)
583584 _ = heartbeat_interval. tick( ) => {
584- let state_hash = state_manager. state_hash( ) ;
585- let sequence = state_manager. sequence( ) ;
586- let our_hotkey = keypair. hotkey( ) ;
587-
588- // Get our stake from validator set
589- let our_stake = validator_set. stake_for( & our_hotkey) ;
590-
591- let heartbeat = P2PMessage :: Heartbeat ( HeartbeatMessage {
592- validator: our_hotkey,
593- state_hash,
594- sequence,
595- stake: our_stake,
596- timestamp: chrono:: Utc :: now( ) . timestamp_millis( ) ,
597- signature: vec![ ] , // Will be signed by P2P layer
598- } ) ;
599-
600- if let Err ( e) = p2p_broadcast_tx. send( platform_p2p_consensus:: P2PCommand :: Broadcast ( heartbeat) ) . await {
601- warn!( "Failed to broadcast heartbeat: {}" , e) ;
585+ if !is_bootnode {
586+ let state_hash = state_manager. state_hash( ) ;
587+ let sequence = state_manager. sequence( ) ;
588+ let our_hotkey = keypair. hotkey( ) ;
589+
590+ // Get our stake from validator set
591+ let our_stake = validator_set. stake_for( & our_hotkey) ;
592+
593+ let heartbeat = P2PMessage :: Heartbeat ( HeartbeatMessage {
594+ validator: our_hotkey,
595+ state_hash,
596+ sequence,
597+ stake: our_stake,
598+ timestamp: chrono:: Utc :: now( ) . timestamp_millis( ) ,
599+ signature: vec![ ] , // Will be signed by P2P layer
600+ } ) ;
601+
602+ if let Err ( e) = p2p_broadcast_tx. send( platform_p2p_consensus:: P2PCommand :: Broadcast ( heartbeat) ) . await {
603+ warn!( "Failed to broadcast heartbeat: {}" , e) ;
604+ }
605+
606+ debug!( "Heartbeat: sequence={}, state_hash={}" , sequence, hex:: encode( & state_hash[ ..8 ] ) ) ;
602607 }
603608
604- // Also update validator activity count
609+ // Update validator activity count (both bootnode and validators)
605610 validator_set. mark_stale_validators( ) ;
606611 debug!( "Active validators: {}" , validator_set. active_count( ) ) ;
607-
608- debug!( "Heartbeat: sequence={}, state_hash={}" , sequence, hex:: encode( & state_hash[ ..8 ] ) ) ;
609612 }
610613
611614 // Periodic state persistence
0 commit comments