Skip to content

Commit 007b920

Browse files
committed
fix: add bootnode retry timer to validator event loop
The validator was not retrying bootnode connections because it used process_next_event() instead of run() which contains the retry logic. Added 30s interval timer to retry bootstrap connections.
1 parent 56f99f9 commit 007b920

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bins/validator-node/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,10 @@ async fn main() -> Result<()> {
10191019

10201020
// Spawn network event loop in a separate task
10211021
tokio::spawn(async move {
1022+
// Bootstrap retry interval - reconnect to bootnode if disconnected
1023+
let mut bootstrap_retry_interval = tokio::time::interval(std::time::Duration::from_secs(30));
1024+
bootstrap_retry_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
1025+
10221026
loop {
10231027
tokio::select! {
10241028
// Process network commands
@@ -1042,6 +1046,10 @@ async fn main() -> Result<()> {
10421046
}
10431047
// Process swarm events
10441048
_ = network.process_next_event() => {}
1049+
// Retry bootstrap connection every 30s if not connected
1050+
_ = bootstrap_retry_interval.tick() => {
1051+
network.retry_bootstrap_if_needed();
1052+
}
10451053
}
10461054
}
10471055
});

0 commit comments

Comments
 (0)