From 6e5fe8f3f419b098e9058c678e242fd8e2769450 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 7 Mar 2017 16:45:35 +0100
Subject: [PATCH] [fix] #855 Update duniter-crawler module + remove buggy
 methods calls

---
 app/lib/dal/fileDAL.js | 9 ---------
 app/lib/dup/indexer.js | 4 ++--
 package.json           | 2 +-
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/app/lib/dal/fileDAL.js b/app/lib/dal/fileDAL.js
index 1da9a1563..d0993aae0 100644
--- a/app/lib/dal/fileDAL.js
+++ b/app/lib/dal/fileDAL.js
@@ -103,11 +103,6 @@ function FileDAL(params) {
     return block || null;
   });
 
-  this.getBlockBuggy = (number) => co(function*() {
-    const block = yield that.blockDAL.getBlock(Math.max(0, number - 1)); // This is the bug: we look at previous block
-    return block || null;
-  });
-
   this.getAbsoluteBlockByNumberAndHash = (number, hash) =>
       that.blockDAL.getAbsoluteBlock(number, hash);
 
@@ -127,10 +122,6 @@ function FileDAL(params) {
     return that.getBlockByNumberAndHash(number, hash);
   };
 
-  this.getBlockByBlockstampBuggy = (blockstamp) => {
-    return that.getBlockBuggy(parseInt(blockstamp));
-  };
-
   this.getBlockByNumberAndHash = (number, hash) => co(function*() {
     try {
       const block = yield that.getBlock(number);
diff --git a/app/lib/dup/indexer.js b/app/lib/dup/indexer.js
index 3938a82fe..f9a71abd7 100644
--- a/app/lib/dup/indexer.js
+++ b/app/lib/dup/indexer.js
@@ -1474,7 +1474,7 @@ const indexer = module.exports = {
           basedBlock = HEAD;
         } else {
           if (HEAD.currency === 'gtest') {
-            basedBlock = yield dal.getBlockByBlockstampBuggy(MS.created_on); // TODO: fix for v1.0.0
+            basedBlock = yield dal.getBlockByBlockstamp(MS.created_on);
           } else {
             basedBlock = yield dal.getBlockByBlockstamp(MS.created_on);
           }
@@ -1493,7 +1493,7 @@ const indexer = module.exports = {
         basedBlock = HEAD;
       } else {
         if (HEAD.currency === 'gtest') {
-          basedBlock = yield dal.getBlockBuggy(CERT.created_on); // TODO: fix for v1.0.0
+          basedBlock = yield dal.getBlock(CERT.created_on);
         } else {
           basedBlock = yield dal.getBlock(CERT.created_on);
         }
diff --git a/package.json b/package.json
index 676398dae..a810dea17 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
     "daemonize2": "0.4.2",
     "duniter-bma": "^0.2.11",
     "duniter-common": "0.1.0",
-    "duniter-crawler": "^0.2.16",
+    "duniter-crawler": "^1.0.0",
     "duniter-keypair": "^0.3.0",
     "duniter-prover": "^1.0.0",
     "event-stream": "3.3.4",
-- 
GitLab