From b6b228896edc746f2d17e4c588a9de56fe1f7d29 Mon Sep 17 00:00:00 2001 From: cgeek <cem.moreau@gmail.com> Date: Wed, 16 Dec 2015 21:15:47 +0100 Subject: [PATCH] Fix #256 fork window size was still set to zero --- app/controllers/node.js | 2 +- app/lib/entity/configuration.js | 2 +- app/lib/sync.js | 3 --- app/service/BlockchainService.js | 2 +- bin/ucoind | 2 +- server.js | 2 +- test/integration/branches.js | 2 +- test/integration/branches2.js | 2 +- test/integration/branches_pending_data.js | 2 +- test/integration/branches_revert.js | 2 +- test/integration/branches_revert2.js | 2 +- test/integration/branches_switch.js | 2 +- test/integration/identity-test.js | 2 +- test/integration/peerings.js | 2 +- test/integration/start_generate_blocks.js | 2 +- test/integration/tests.js | 2 +- 16 files changed, 15 insertions(+), 18 deletions(-) diff --git a/app/controllers/node.js b/app/controllers/node.js index 72aa32c9e..49a4ce8a1 100644 --- a/app/controllers/node.js +++ b/app/controllers/node.js @@ -14,7 +14,7 @@ function NodeBinding (server) { "ucoin": { "software": "ucoind", "version": server.version, - "forkWindowSize": server.conf.branchesWindowSize + "forkWindowSize": server.conf.forksize } }, null, " ")); }; diff --git a/app/lib/entity/configuration.js b/app/lib/entity/configuration.js index 06ace73ca..bfa9353bd 100644 --- a/app/lib/entity/configuration.js +++ b/app/lib/entity/configuration.js @@ -38,7 +38,7 @@ var defaultConf = function() { "timeout": 3000, "routing": false, "isolate": false, - "branchesWindowSize": constants.BRANCHES.DEFAULT_WINDOW_SIZE + "forksize": constants.BRANCHES.DEFAULT_WINDOW_SIZE }; }; diff --git a/app/lib/sync.js b/app/lib/sync.js index 8d032ea48..11c87d51c 100644 --- a/app/lib/sync.js +++ b/app/lib/sync.js @@ -21,9 +21,6 @@ module.exports = function Synchroniser (server, host, port, conf, interactive) { var speed = 0, syncStart = new Date(), blocksApplied = 0; var watcher = interactive ? new MultimeterWatcher() : new LoggerWatcher(); - // Disable branching for the main synchronization parts - conf.branchesWindowSize = 0; - if (interactive) { require('log4js').configure({ "appenders": [ diff --git a/app/service/BlockchainService.js b/app/service/BlockchainService.js index b2b42d79f..1135d80d0 100644 --- a/app/service/BlockchainService.js +++ b/app/service/BlockchainService.js @@ -196,7 +196,7 @@ function BlockchainService (conf, mainDAL, pair) { return res; } else { // add it as side chain - if (current.number - obj.number + 1 >= conf.branchesWindowSize) { + if (current.number - obj.number + 1 >= conf.forksize) { throw 'Block out of fork window'; } let absolute = yield mainDAL.getAbsoluteBlockByNumberAndHash(obj.number, obj.hash); diff --git a/bin/ucoind b/bin/ucoind index 55c40710b..9587b5cc6 100755 --- a/bin/ucoind +++ b/bin/ucoind @@ -727,7 +727,7 @@ function commandLineConf(conf) { if (cli.db.mdb) conf.mdb = cli.db.mdb; if (cli.isolate) conf.isolate = cli.isolate; if (cli.timeout) conf.timeout = cli.timeout; - if (cli.forksize != null) conf.branchesWindowSize = cli.forksize; + if (cli.forksize != null) conf.forksize = cli.forksize; // Specific internal settings conf.createNext = true; diff --git a/server.js b/server.js index 6928db458..7adfc7ef1 100644 --- a/server.js +++ b/server.js @@ -129,7 +129,7 @@ function Server (dbConf, overrideConf) { dtDiffEval: constants.CONTRACT.DEFAULT.DTDIFFEVAL, medianTimeBlocks: constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, rootoffset: 0, - branchesWindowSize: constants.BRANCHES.DEFAULT_WINDOW_SIZE + forksize: constants.BRANCHES.DEFAULT_WINDOW_SIZE }; _.keys(defaultValues).forEach(function(key){ if (that.conf[key] == undefined) { diff --git a/test/integration/branches.js b/test/integration/branches.js index ec1474ea4..099f962d8 100644 --- a/test/integration/branches.js +++ b/test/integration/branches.js @@ -26,7 +26,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/branches2.js b/test/integration/branches2.js index bf6e92ce2..5b8eca1de 100644 --- a/test/integration/branches2.js +++ b/test/integration/branches2.js @@ -19,7 +19,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/branches_pending_data.js b/test/integration/branches_pending_data.js index 0183355b7..8f93fa2b1 100644 --- a/test/integration/branches_pending_data.js +++ b/test/integration/branches_pending_data.js @@ -18,7 +18,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/branches_revert.js b/test/integration/branches_revert.js index b2ed6c7aa..a4c13c7ed 100644 --- a/test/integration/branches_revert.js +++ b/test/integration/branches_revert.js @@ -17,7 +17,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/branches_revert2.js b/test/integration/branches_revert2.js index 0ab735ea4..f8a294ef6 100644 --- a/test/integration/branches_revert2.js +++ b/test/integration/branches_revert2.js @@ -18,7 +18,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/branches_switch.js b/test/integration/branches_switch.js index be5700943..1ea608f1e 100644 --- a/test/integration/branches_switch.js +++ b/test/integration/branches_switch.js @@ -19,7 +19,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/identity-test.js b/test/integration/identity-test.js index 12861f5ae..247a705de 100644 --- a/test/integration/identity-test.js +++ b/test/integration/identity-test.js @@ -18,7 +18,7 @@ var commonConf = { ipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/peerings.js b/test/integration/peerings.js index c50b7c822..50b9aae0c 100644 --- a/test/integration/peerings.js +++ b/test/integration/peerings.js @@ -26,7 +26,7 @@ var commonConf = { remoteipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 3, + forksize: 3, parcatipate: false, // TODO: to remove when startGeneration will be an explicit call sigQty: 1 }; diff --git a/test/integration/start_generate_blocks.js b/test/integration/start_generate_blocks.js index 5d3a46725..cf8ce8c95 100644 --- a/test/integration/start_generate_blocks.js +++ b/test/integration/start_generate_blocks.js @@ -23,7 +23,7 @@ var commonConf = { remoteipv4: '127.0.0.1', currency: 'bb', httpLogs: true, - branchesWindowSize: 0, + forksize: 0, sigQty: 1 }; diff --git a/test/integration/tests.js b/test/integration/tests.js index 68934e7bd..87a323ced 100644 --- a/test/integration/tests.js +++ b/test/integration/tests.js @@ -125,7 +125,7 @@ describe("Integration", function() { pub: 'DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV', sec: '468Q1XtTq7h84NorZdWBZFJrGkB18CbmbHr9tkp9snt5GiERP7ySs3wM8myLccbAAGejgMRC9rqnXuW3iAfZACm7' }, - branchesWindowSize: 3, + forksize: 3, participate: false, rootoffset: 10, sigQty: 1, dt: 0, ud0: 120 }); -- GitLab