Przeglądaj źródła

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 tydzień temu
rodzic
commit
7519de7db0
1 zmienionych plików z 4 dodań i 0 usunięć
  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
         }