Преглед изворни кода

darkfid/task/sync: error out if sync is incomplete and all peers are failing so node can keep retrying and doesn't consider its state synced

x пре 1 недеља
родитељ
комит
7519de7db0
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      bin/darkfid/src/task/sync.rs

+ 4 - 0
bin/darkfid/src/task/sync.rs

@@ -497,6 +497,10 @@ async fn retrieve_blocks(
         }
         if count == peer_subs.len() {
             debug!(target: "darkfid::task::sync::retrieve_blocks", "All peer connections failed.");
+            // Check if sync completed
+            if !validator.blockchain.headers.is_empty_sync()? {
+                return Err(Error::NetworkOperationFailed)
+            }
             break
         }