소스 검색

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
         }