From 0e9cd32cc5522fbeff8208c70c94a4eac81eac8f Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Sat, 17 Nov 2018 16:19:57 +0100
Subject: [PATCH] [enh] Take into account `--cautious` mode for sync when given

---
 app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
index fb9ba5120..65ebab902 100644
--- a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
+++ b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
@@ -84,6 +84,7 @@ export class GlobalIndexStream extends Duplex {
               private dal:FileDAL,
               private to: number,
               private localNumber:number,
+              private cautious: boolean,
               private syncStrategy: AbstractSynchronizer,
               private watcher:Watcher,
     ) {
@@ -172,7 +173,7 @@ export class GlobalIndexStream extends Duplex {
         await DuniterBlockchain.saveParametersForRoot(block, this.conf, this.dal)
       }
 
-      if (block.number <= this.to - this.conf.forksize || cliprogram.noSources) { // If we require nosources option, this blockchain can't be valid so we don't make checks
+      if ((block.number <= this.to - this.conf.forksize || cliprogram.noSources) && !this.cautious) { // If we require nosources option, this blockchain can't be valid so we don't make checks
 
         const HEAD = await Indexer.quickCompleteGlobalScope(block, this.sync_currConf, sync_bindex, data.iindex, data.mindex, data.cindex, this.dal)
         sync_bindex.push(HEAD)
-- 
GitLab