From 974a44a662ef17097f25c11c11bbc2005ced1765 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 7 Mar 2017 17:25:38 +0100
Subject: [PATCH] [fix] #847 Add parameters to /blockchain/parameters

---
 app/lib/dal/fileDALs/confDAL.js |  5 ++++-
 package.json                    |  2 +-
 test/integration/http_api.js    | 15 ++++++++++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/app/lib/dal/fileDALs/confDAL.js b/app/lib/dal/fileDALs/confDAL.js
index e6331af33..e9ab9b82a 100644
--- a/app/lib/dal/fileDALs/confDAL.js
+++ b/app/lib/dal/fileDALs/confDAL.js
@@ -40,7 +40,10 @@ function ConfDAL(rootPath, qioFS, parentCore, localDAL, AbstractStorage) {
       "medianTimeBlocks": parseInt(conf.medianTimeBlocks,10),
       "avgGenTime": parseInt(conf.avgGenTime,10),
       "dtDiffEval": parseInt(conf.dtDiffEval,10),
-      "percentRot": parseFloat(conf.percentRot)
+      "percentRot": parseFloat(conf.percentRot),
+      "udTime0": parseInt(conf.udTime0),
+      "udReevalTime0": parseInt(conf.udReevalTime0),
+      "dtReeval": parseInt(conf.dtReeval)
     };
   });
 
diff --git a/package.json b/package.json
index a810dea17..28e7e1ef1 100644
--- a/package.json
+++ b/package.json
@@ -42,8 +42,8 @@
     "colors": "1.1.2",
     "commander": "2.9.0",
     "daemonize2": "0.4.2",
-    "duniter-bma": "^0.2.11",
     "duniter-common": "0.1.0",
+    "duniter-bma": "^1.0.0",
     "duniter-crawler": "^1.0.0",
     "duniter-keypair": "^0.3.0",
     "duniter-prover": "^1.0.0",
diff --git a/test/integration/http_api.js b/test/integration/http_api.js
index 820593a1b..86171f3f5 100644
--- a/test/integration/http_api.js
+++ b/test/integration/http_api.js
@@ -21,6 +21,10 @@ const server = duniter(
   currency: 'bb',
   httpLogs: true,
   sigQty: 1,
+  dt: 60,
+  dtReeval: 120,
+  udTime0: 1488902199,
+  udReevalTime0: 1520438199,
   pair: {
     pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
     sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
@@ -61,6 +65,15 @@ describe("HTTP API", function() {
 
   describe("/blockchain", function() {
 
+    it('/parameters/ should give the parameters', function() {
+      return expectJSON(rp('http://127.0.0.1:7777/blockchain/parameters', { json: true }), {
+        udTime0: 1488902199,
+        udReevalTime0: 1520438199,
+        dt: 60,
+        dtReeval: 120
+      });
+    });
+
     it('/block/0 should exist', function() {
       return expectJSON(rp('http://127.0.0.1:7777/blockchain/block/0', { json: true }), {
         number: 0
@@ -154,7 +167,7 @@ describe("HTTP API", function() {
       client.on('message', function message(data) {
         const block = JSON.parse(data);
         should(block).have.property('number', 4);
-        should(block).have.property('dividend', null);
+        should(block).have.property('dividend');
         if (!completed) {
           completed = true;
           done();
-- 
GitLab