From f650e20765a5f760ee4056dd8c13aba92eeb2e76 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 10 Jan 2017 17:13:08 +0100
Subject: [PATCH] [enh] UD has now 4 digits

---
 app/lib/constants.js   | 2 +-
 app/lib/dup/indexer.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/lib/constants.js b/app/lib/constants.js
index b2f8138be..09f5e39b1 100644
--- a/app/lib/constants.js
+++ b/app/lib/constants.js
@@ -146,7 +146,7 @@ module.exports = {
   TRANSACTION_VERSION: 10,
 
   REVOCATION_FACTOR: 2, // This is protocol fixed value
-  NB_DIGITS_UD: 6,      // This is protocol fixed value
+  NB_DIGITS_UD: 4,      // This is protocol fixed value
   FIRST_UNIT_BASE: 0,
 
   TRANSACTION_EXPIRY_DELAY: 3600 * 24 * 7,
diff --git a/app/lib/dup/indexer.js b/app/lib/dup/indexer.js
index 7955f821b..84bbc11a0 100644
--- a/app/lib/dup/indexer.js
+++ b/app/lib/dup/indexer.js
@@ -837,7 +837,7 @@ const indexer = module.exports = {
 
   // BR_G14
   prepareUnitBase: (HEAD) => {
-    if (HEAD.dividend >= Math.pow(10, 6)) {
+    if (HEAD.dividend >= Math.pow(10, constants.NB_DIGITS_UD)) {
       HEAD.dividend = Math.ceil(HEAD.dividend / 10);
       HEAD.new_dividend = HEAD.dividend;
       HEAD.unitBase = HEAD.unitBase + 1;
-- 
GitLab