diff --git a/app/lib/computation/permanentProver.js b/app/lib/computation/permanentProver.js index b3167746cd5c8ffd70c587345ff835f418914161..5988a265d1a836f96b4ab7883766320bbf749daa 100644 --- a/app/lib/computation/permanentProver.js +++ b/app/lib/computation/permanentProver.js @@ -7,14 +7,11 @@ const parsers = require('../streams/parsers'); module.exports = (server) => new PermanentProver(server); -function PermanentProver() { +function PermanentProver(server) { const logger = require('../logger')('permprover'); const that = this; - // The server on which is done the proof - let server; - let blockchainChangedResolver = null, promiseOfWaitingBetween2BlocksOfOurs = null, lastComputedBlock = null; @@ -23,8 +20,7 @@ function PermanentProver() { let resolveContinuePromise = null; let continuePromise = new Promise((resolve) => resolveContinuePromise = resolve); - this.allowedToStart = (onServer) => { - server = onServer; + this.allowedToStart = () => { resolveContinuePromise(true); }; diff --git a/app/lib/system/network.js b/app/lib/system/network.js index ad358acaf502939bcb911ba48c93e9a85f135c84..a11a911e7eaae54fdb6872a8e314f7d35c96a9dd 100644 --- a/app/lib/system/network.js +++ b/app/lib/system/network.js @@ -28,7 +28,7 @@ module.exports = { listInterfaces: bmapiMethods.listInterfaces, - upnpConf: bmapiMethods.upnpConf, + upnpConf: (noupnp) => bmapiMethods.upnpConf(noupnp, logger), getRandomPort: bmapiMethods.getRandomPort, diff --git a/app/modules/bmapi.js b/app/modules/bmapi.js index c95a6611657e94c39f326063a593b779eeb96a60..f245b4e4ebe35ecb9e0cd8b44f42e461794a90a2 100644 --- a/app/modules/bmapi.js +++ b/app/modules/bmapi.js @@ -21,18 +21,18 @@ module.exports = { wizard: { - 'network': (conf, program) => co(function*() { - yield Q.nbind(networkConfiguration, null, conf)(); + 'network': (conf, program, logger) => co(function*() { + yield Q.nbind(networkConfiguration, null, conf, logger)(); }), - 'network-reconfigure': (conf, program) => co(function*() { - yield Q.nbind(networkReconfiguration, null, conf, program.autoconf, program.noupnp)(); + 'network-reconfigure': (conf, program, logger) => co(function*() { + yield Q.nbind(networkReconfiguration, null, conf, logger, program.autoconf, program.noupnp)(); }) }, config: { - onLoading: (conf, program) => co(function*(){ + onLoading: (conf, program, logger) => co(function*(){ // Network autoconf const autoconfNet = program.autoconf @@ -40,7 +40,7 @@ module.exports = { || !(conf.remoteipv4 || conf.remoteipv6 || conf.remotehost) || !(conf.port && conf.remoteport); if (autoconfNet) { - yield Q.nbind(networkReconfiguration, null)(conf, autoconfNet, program.noupnp); + yield Q.nbind(networkReconfiguration, null)(conf, autoconfNet, logger, program.noupnp); } // Default value @@ -59,7 +59,7 @@ module.exports = { }, service: { - input: () => new BMAPI() + input: (server, conf, logger) => new BMAPI(server, conf, logger) }, methods: { @@ -68,18 +68,16 @@ module.exports = { } } -function BMAPI() { +function BMAPI(server, conf, logger) { // Public http interface let bmapi; // UPnP API let upnpAPI; - let logger; stream.Transform.call(this, { objectMode: true }); - this.startService = (server, conf) => co(function*() { - logger = server.logger; + this.startService = () => co(function*() { const bma = require('../lib/streams/bma'); bmapi = yield bma(server, null, conf.httplogs); yield bmapi.openConnections(); @@ -87,11 +85,11 @@ function BMAPI() { /*************** * UPnP **************/ + if (upnpAPI) { + upnpAPI.stopRegular(); + } if (conf.upnp) { try { - if (upnpAPI) { - upnpAPI.stopRegular(); - } upnpAPI = yield upnp(conf.port, conf.remoteport); upnpAPI.startRegular(); } catch (e) { @@ -101,7 +99,9 @@ function BMAPI() { }); this.stopService = () => co(function*() { - yield bmapi.closeConnections(); + if (bmapi) { + yield bmapi.closeConnections(); + } if (upnpAPI) { upnpAPI.stopRegular(); } @@ -110,9 +110,9 @@ function BMAPI() { -function networkReconfiguration(conf, autoconf, noupnp, done) { +function networkReconfiguration(conf, autoconf, logger, noupnp, done) { async.waterfall([ - upnpResolve.bind(this, noupnp), + upnpResolve.bind(this, noupnp, logger), function(upnpSuccess, upnpConf, next) { // Default values @@ -121,8 +121,8 @@ function networkReconfiguration(conf, autoconf, noupnp, done) { var localOperations = getLocalNetworkOperations(conf, autoconf); var remoteOpertions = getRemoteNetworkOperations(conf, upnpConf.remoteipv4, upnpConf.remoteipv6, autoconf); - var dnsOperations = getHostnameOperations(conf, autoconf); - var useUPnPOperations = getUseUPnPOperations(conf, autoconf); + var dnsOperations = getHostnameOperations(conf, logger, autoconf); + var useUPnPOperations = getUseUPnPOperations(conf, logger, autoconf); if (upnpSuccess) { _.extend(conf, upnpConf); @@ -130,9 +130,9 @@ function networkReconfiguration(conf, autoconf, noupnp, done) { var remote = [conf.remoteipv4, conf.remoteport].join(':'); if (autoconf) { conf.ipv6 = conf.remoteipv6 = getBestLocalIPv6(); - console.log('IPv6: %s', conf.ipv6 || ""); - console.log('Local IPv4: %s', local); - console.log('Remote IPv4: %s', remote); + logger.info('IPv6: %s', conf.ipv6 || ""); + logger.info('Local IPv4: %s', local); + logger.info('Remote IPv4: %s', remote); // Use proposed local + remote with UPnP binding return async.waterfall(useUPnPOperations .concat(dnsOperations), next); @@ -158,13 +158,13 @@ function networkReconfiguration(conf, autoconf, noupnp, done) { // Yes: local configuration = remote configuration return async.waterfall( localOperations - .concat(getHostnameOperations(conf, autoconf)) + .concat(getHostnameOperations(conf, logger, autoconf)) .concat([function (confDone) { conf.remoteipv4 = conf.ipv4; conf.remoteipv6 = conf.ipv6; conf.remoteport = conf.port; - console.log('Local & Remote IPv4: %s', [conf.ipv4, conf.port].join(':')); - console.log('Local & Remote IPv6: %s', [conf.ipv6, conf.port].join(':')); + logger.info('Local & Remote IPv4: %s', [conf.ipv4, conf.port].join(':')); + logger.info('Local & Remote IPv6: %s', [conf.ipv6, conf.port].join(':')); confDone(); }]), next); } @@ -173,7 +173,7 @@ function networkReconfiguration(conf, autoconf, noupnp, done) { // Yes: local configuration = remote configuration async.waterfall( localOperations - .concat(getHostnameOperations(conf)) + .concat(getHostnameOperations(conf, logger)) .concat([function(confDone) { conf.remoteipv4 = conf.ipv4; conf.remoteipv6 = conf.ipv6; @@ -194,10 +194,10 @@ function networkReconfiguration(conf, autoconf, noupnp, done) { } -function upnpResolve(noupnp, done) { +function upnpResolve(noupnp, logger, done) { return co(function *() { try { - let conf = yield upnpConf(noupnp); + let conf = yield upnpConf(noupnp, logger); done(null, true, conf); } catch (err) { done(null, false, {}); @@ -205,19 +205,19 @@ function upnpResolve(noupnp, done) { }); } -function networkConfiguration(conf, done) { +function networkConfiguration(conf, logger, done) { async.waterfall([ - upnpResolve.bind(this, !conf.upnp), + upnpResolve.bind(this, !conf.upnp, logger), function(upnpSuccess, upnpConf, next) { var operations = getLocalNetworkOperations(conf) .concat(getRemoteNetworkOperations(conf, upnpConf.remoteipv4, upnpConf.remoteipv6)); if (upnpSuccess) { - operations = operations.concat(getUseUPnPOperations(conf)); + operations = operations.concat(getUseUPnPOperations(conf, logger)); } - async.waterfall(operations.concat(getHostnameOperations(conf, false)), next); + async.waterfall(operations.concat(getHostnameOperations(conf, logger, false)), next); } ], done); } @@ -380,14 +380,14 @@ function getRemoteNetworkOperations(conf, remoteipv4) { ]; } -function getHostnameOperations(conf, autoconf) { +function getHostnameOperations(conf, logger, autoconf) { return [function(next) { if (!conf.ipv4) { conf.remotehost = null; return next(); } if (autoconf) { - console.log('DNS: %s', conf.remotehost || 'No'); + logger.info('DNS: %s', conf.remotehost || 'No'); return next(); } choose("Does this server has a DNS name?", !!conf.remotehost, @@ -402,14 +402,14 @@ function getHostnameOperations(conf, autoconf) { }]; } -function getUseUPnPOperations(conf, autoconf) { +function getUseUPnPOperations(conf, logger, autoconf) { return [function(next) { if (!conf.ipv4) { conf.upnp = false; return next(); } if (autoconf) { - console.log('UPnP: %s', 'Yes'); + logger.info('UPnP: %s', 'Yes'); conf.upnp = true; return next(); } @@ -436,14 +436,14 @@ function choose (question, defaultValue, ifOK, ifNotOK) { }); } -function upnpConf (noupnp) { +function upnpConf (noupnp, logger) { return co(function *() { const conf = {}; const client = require('nnupnp').createClient(); // Look for 2 random ports const privatePort = getRandomPort(conf); const publicPort = privatePort; - console.log('Checking UPnP features...'); + logger.info('Checking UPnP features...'); if (noupnp) { throw Error('No UPnP'); } diff --git a/app/modules/crawler.js b/app/modules/crawler.js index 18b6286a84099839877bcc5a8dbb228e00fb1dd1..463ccefc38b0eebe697902fc0577d187e92328ca 100644 --- a/app/modules/crawler.js +++ b/app/modules/crawler.js @@ -10,15 +10,19 @@ const querablep = require('../lib/querablep'); const pulling = require('../lib/pulling'); const Transaction = require('../lib/entity/transaction'); -const crawler = new Crawler(); - module.exports = { duniter: { service: { - neutral: () => crawler + neutral: (server, conf, logger) => new Crawler(server, conf, logger) }, - methods: { pullBlocks: crawler.pullBlocks } + methods: { + + pullBlocks: (server, pubkey) => co(function*() { + const crawler = new Crawler(server, server.conf, server.logger); + return crawler.pullBlocks(server, pubkey); + }) + } } } @@ -26,19 +30,19 @@ module.exports = { * Service which triggers the server's peering generation (actualization of the Peer document). * @constructor */ -function Crawler() { +function Crawler(server, conf, logger) { - const peerCrawler = new PeerCrawler(); - const peerTester = new PeerTester(); - const blockCrawler = new BlockCrawler(); + const peerCrawler = new PeerCrawler(server, conf, logger); + const peerTester = new PeerTester(server, conf, logger); + const blockCrawler = new BlockCrawler(server, logger); this.pullBlocks = blockCrawler.pullBlocks; - this.startService = (server, conf) => co(function*() { + this.startService = () => co(function*() { return yield [ - peerCrawler.startService(server, conf), - peerTester.startService(server, conf), - blockCrawler.startService(server, conf) + peerCrawler.startService(), + peerTester.startService(), + blockCrawler.startService() ]; }); @@ -51,16 +55,15 @@ function Crawler() { }); } -function PeerCrawler() { +function PeerCrawler(server, conf, logger) { const DONT_IF_MORE_THAN_FOUR_PEERS = true; - let crawlPeersInterval = null, logger; + let crawlPeersInterval = null; const crawlPeersFifo = async.queue((task, callback) => task(callback), 1); - this.startService = (server, conf) => co(function*() { - logger = server.logger; + this.startService = () => co(function*() { if (crawlPeersInterval) clearInterval(crawlPeersInterval); crawlPeersInterval = setInterval(() => crawlPeersFifo.push(() => crawlPeers(server, conf)), 1000 * conf.avgGenTime * constants.NETWORK.SYNC_PEERS_INTERVAL); @@ -140,16 +143,14 @@ function PeerCrawler() { }); } -function PeerTester() { +function PeerTester(server, conf, logger) { const FIRST_CALL = true; const testPeerFifo = async.queue((task, callback) => task(callback), 1); let testPeerFifoInterval = null; - let logger; - this.startService = (server, conf) => co(function*() { - logger = server.logger; + this.startService = () => co(function*() { if (testPeerFifoInterval) clearInterval(testPeerFifoInterval); testPeerFifoInterval = setInterval(() => testPeerFifo.push(testPeers.bind(null, server, conf, !FIRST_CALL)), 1000 * constants.NETWORK.TEST_PEERS_INTERVAL); @@ -240,7 +241,7 @@ function PeerTester() { } } -function BlockCrawler() { +function BlockCrawler(server, logger) { const CONST_BLOCKS_CHUNK = 50; @@ -249,10 +250,8 @@ function BlockCrawler() { let pullingActualIntervalDuration = constants.PULLING_MINIMAL_DELAY; const syncBlockFifo = async.queue((task, callback) => task(callback), 1); let syncBlockInterval = null; - let logger = require('../lib/logger')('crawler'); - this.startService = (server, conf) => co(function*() { - logger = server.logger; + this.startService = () => co(function*() { if (syncBlockInterval) clearInterval(syncBlockInterval); syncBlockInterval = setInterval(() => syncBlockFifo.push(() => syncBlock(server)), 1000 * pullingActualIntervalDuration); diff --git a/app/modules/daemon.js b/app/modules/daemon.js index fc6420dc2127ce817d0c81ccf7add88b5f21981d..62c0c840e202e991e15eabedaa274d5d450b272b 100644 --- a/app/modules/daemon.js +++ b/app/modules/daemon.js @@ -29,16 +29,16 @@ module.exports = { name: 'stop', desc: 'Stop Duniter node daemon.', logs: false, - onConfiguredExecute: () => needsToBeLaunchedByScript() + onConfiguredExecute: (server) => needsToBeLaunchedByScript(server.logger) },{ name: 'restart', desc: 'Restart Duniter node daemon.', logs: false, - onConfiguredExecute: () => needsToBeLaunchedByScript() + onConfiguredExecute: (server) => needsToBeLaunchedByScript(server.logger) }] } }; -function needsToBeLaunchedByScript() { - console.error('This command must not be launched directly, please use duniter.sh script'); +function needsToBeLaunchedByScript(logger) { + logger.error('This command must not be launched directly, please use duniter.sh script'); } diff --git a/app/modules/peersignal.js b/app/modules/peersignal.js index 93c52a1618a9fa7023112bfa1dc0c81d65b5ad2d..b8c9361f05931af799ff5ea0a96bb82bb9704004 100644 --- a/app/modules/peersignal.js +++ b/app/modules/peersignal.js @@ -7,7 +7,7 @@ const constants = require('../lib/constants'); module.exports = { duniter: { service: { - neutral: () => new PeerSignalEmitter() + neutral: (server, conf, logger) => new PeerSignalEmitter(server, conf, logger) } } } @@ -16,7 +16,7 @@ module.exports = { * Service which triggers the server's peering generation (actualization of the Peer document). * @constructor */ -function PeerSignalEmitter() { +function PeerSignalEmitter(server, conf) { let INTERVAL = null; @@ -24,7 +24,7 @@ function PeerSignalEmitter() { task(callback); }, 1); - this.startService = (server, conf) => co(function*() { + this.startService = () => co(function*() { // The interval duration const SIGNAL_INTERVAL = 1000 * conf.avgGenTime * constants.NETWORK.STATUS_INTERVAL.UPDATE; diff --git a/app/modules/prover.js b/app/modules/prover.js index babeff7b21dcadc6a6bf83736073a711bbc70630..035831c2dca98f7ed1afdf87de748563bd435a59 100644 --- a/app/modules/prover.js +++ b/app/modules/prover.js @@ -9,18 +9,18 @@ const permanentProver = require('../lib/computation/permanentProver'); module.exports = { duniter: { service: { - output: () => new Prover() + output: (server, conf, logger) => new Prover(server, conf, logger) }, methods: { - prover: () => new Prover() + prover: (server, conf, logger) => new Prover(server, conf, logger) } } } -function Prover() { +function Prover(server) { - const permaProver = this.permaProver = permanentProver(); + const permaProver = this.permaProver = permanentProver(server); stream.Transform.call(this, { objectMode: true }); @@ -32,8 +32,8 @@ function Prover() { done && done(); }; - this.startService = (server) => co(function*() { - permaProver.allowedToStart(server); + this.startService = () => co(function*() { + permaProver.allowedToStart(); }); this.stopService = () => co(function*() { diff --git a/app/modules/router.js b/app/modules/router.js index af458c6a582c34ed4644f5f4e1dfbcf1ad2b96a3..60f1f6aef3e8383374de35076b38eb8dda30f992 100644 --- a/app/modules/router.js +++ b/app/modules/router.js @@ -10,12 +10,12 @@ const multicaster = require('../lib/streams/multicaster'); module.exports = { duniter: { service: { - output: () => new Router() + output: (server, conf, logger) => new Router(server, conf, logger) }, methods: { routeToNetwork: (server) => { - const router = new Router(); - router.startService(server); + const router = new Router(server); + router.startService(); server.pipe(router); } } @@ -26,7 +26,7 @@ module.exports = { * Service which triggers the server's peering generation (actualization of the Peer document). * @constructor */ -function Router() { +function Router(server) { const that = this; let theRouter, theMulticaster = multicaster(); @@ -41,7 +41,7 @@ function Router() { done && done(); }; - this.startService = (server) => co(function*() { + this.startService = () => co(function*() { if (!theRouter) { theRouter = router(server.PeeringService, server.dal); } @@ -54,7 +54,7 @@ function Router() { * - The server will eventually be notified of network failures */ // The router asks for multicasting of documents - server.pipe(that) + that .pipe(theRouter) // The documents get sent to peers .pipe(theMulticaster) @@ -64,8 +64,8 @@ function Router() { this.stopService = () => co(function*() { that.unpipe(); - theRouter.unpipe(); - theMulticaster.unpipe(); + theRouter && theRouter.unpipe(); + theMulticaster && theMulticaster.unpipe(); }); } diff --git a/app/modules/wizard.js b/app/modules/wizard.js index 95fa1e0ead23aa5e5cec49f334a595d1db329578..e3ff952a7ffa8db70432051b450a642f75e34520 100644 --- a/app/modules/wizard.js +++ b/app/modules/wizard.js @@ -25,7 +25,7 @@ module.exports = { const step = params[0]; const tasks = step ? [wizardTasks[step]] : Object.values(wizardTasks); for (const task of tasks) { - yield task(conf, program); + yield task(conf, program, server.logger); } // Check config yield server.checkConfig(); diff --git a/index.js b/index.js index 7c01587da1cbd82f0965c9d34341098edc4fa54d..404b1d324bc172e40858e99e94623397d99f2091 100644 --- a/index.js +++ b/index.js @@ -110,6 +110,7 @@ function Stack(dependencies) { const loaded = {}; const wizardTasks = {}; + const definitions = []; const streams = { input: [], process: [], @@ -124,6 +125,7 @@ function Stack(dependencies) { } loaded[name] = true; const def = requiredObject.duniter; + definitions.push(def); for (const opt of (def.cliOptions || [])) { cli.addOption(opt.value, opt.desc, opt.parser); } @@ -158,29 +160,6 @@ function Stack(dependencies) { wizardTasks[name] = def.wizard[name]; } } - - /** - * Service injection - * ----------------- - */ - if (def.service) { - // To feed data coming from some I/O (network, disk, other module, ...) - if (def.service.input) { - streams.input.push(def.service.input()); - } - // To handle data that has been submitted by INPUT stream - if (def.service.process) { - streams.process.push(def.service.process()); - } - // To handle data that has been validated by PROCESS stream - if (def.service.output) { - streams.output.push(def.service.output()); - } - // Special service which does not stream anything particular (ex.: piloting the `server` object) - if (def.service.neutral) { - streams.neutral.push(def.service.neutral()); - } - } }; this.processCommand = (...args) => co(function*() { @@ -228,7 +207,7 @@ function Stack(dependencies) { server.dal.loadConfHook = (conf) => co(function*() { // Loading injection for (const callback of configLoadingCallbacks) { - yield callback(conf, program); + yield callback(conf, program, logger); } }); @@ -236,7 +215,7 @@ function Stack(dependencies) { server.dal.saveConfHook = (conf) => co(function*() { const clonedConf = _.clone(conf); for (const callback of configBeforeSaveCallbacks) { - yield callback(clonedConf, program); + yield callback(clonedConf, program, logger); } return clonedConf; }); @@ -258,13 +237,39 @@ function Stack(dependencies) { } // Second possible class of commands: post-service yield server.initDAL(); + + /** + * Service injection + * ----------------- + */ + for (const def of definitions) { + if (def.service) { + // To feed data coming from some I/O (network, disk, other module, ...) + if (def.service.input) { + streams.input.push(def.service.input(server, conf, logger)); + } + // To handle data that has been submitted by INPUT stream + if (def.service.process) { + streams.process.push(def.service.process(server, conf, logger)); + } + // To handle data that has been validated by PROCESS stream + if (def.service.output) { + streams.output.push(def.service.output(server, conf, logger)); + } + // Special service which does not stream anything particular (ex.: piloting the `server` object) + if (def.service.neutral) { + streams.neutral.push(def.service.neutral(server, conf, logger)); + } + } + } + return yield command.onPluggedDALExecute(server, conf, program, params, // Start services and streaming between them () => co(function*() { const modules = streams.input.concat(streams.process).concat(streams.output).concat(streams.neutral); // Any streaming module must implement a `startService` method - yield modules.map(module => module.startService(server, conf)); + yield modules.map(module => module.startService()); // All inputs write to global INPUT stream for (const module of streams.input) module.pipe(INPUT); // All processes read from global INPUT stream diff --git a/test/integration/continuous-proof.js b/test/integration/continuous-proof.js index 39653a22ee87d910fd762a1608c9757a9012b7d1..865ea9ede7d3ba9f584947c02dffb5d5b0402fff 100644 --- a/test/integration/continuous-proof.js +++ b/test/integration/continuous-proof.js @@ -8,6 +8,12 @@ const constants = require('../../app/lib/constants'); const keyring = require('../../app/lib/crypto/keyring'); const blockProver = require('../../app/lib/computation/blockProver'); +// Trace these errors +process.on('unhandledRejection', (reason) => { + console.error('Unhandled rejection: ' + reason); + console.error(reason); +}); + const s1 = toolbox.server({ powDelay: 1000, powMin: 32, @@ -97,11 +103,13 @@ describe("Continous proof-of-work", function() { yield s2.commit(); s2.conf.cpu = 0.5; s3.conf.cpu = 0.5; - s2.startBlockComputation(); - s3.startBlockComputation(); yield [ s2.until('block', 10), - s3.until('block', 10) + s3.until('block', 10), + co(function*() { + s2.startBlockComputation(); + s3.startBlockComputation(); + }) ]; })); diff --git a/test/integration/start_generate_blocks.js b/test/integration/start_generate_blocks.js index 38fd8c92fb7839768211457bc4499479ec183a1b..8aebbcdb73a31a24920d64004dc12ca5411f0dbe 100644 --- a/test/integration/start_generate_blocks.js +++ b/test/integration/start_generate_blocks.js @@ -72,8 +72,8 @@ describe("Generation", function() { yield server.bma.openConnections(); require('../../app/modules/router').duniter.methods.routeToNetwork(server); yield server.PeeringService.generateSelfPeer(server.conf, 0); - const prover = require('../../app/modules/prover').duniter.methods.prover(); - server.startBlockComputation = () => prover.startService(server); + const prover = require('../../app/modules/prover').duniter.methods.prover(server); + server.startBlockComputation = () => prover.startService(); server.stopBlockComputation = () => prover.stopService(); } nodeS1 = contacter('127.0.0.1', s1.conf.port); diff --git a/test/integration/tools/node.js b/test/integration/tools/node.js index d5faaf13ee5c0ab88ea953ff93005a7207756c05..832c5fc7f661a731c9169e14832ea8c212aa1381 100644 --- a/test/integration/tools/node.js +++ b/test/integration/tools/node.js @@ -150,6 +150,13 @@ function Node (dbName, options) { _.extend(conf, overConf); }) }, + service: { + process: (server) => _.extend(server, { + startService: () => { + logger.debug('Server Servie Started!'); + } + }) + }, cli: [{ name: 'execute', desc: 'Unit Test execution', diff --git a/test/integration/tools/toolbox.js b/test/integration/tools/toolbox.js index c6a61fd34b1d0864dc3923d3614b5baec25bed77..0a5365381fe345f1d65720de15a3e14a93f75401 100644 --- a/test/integration/tools/toolbox.js +++ b/test/integration/tools/toolbox.js @@ -286,10 +286,10 @@ module.exports = { require('../../../app/modules/router').duniter.methods.routeToNetwork(server); }); - const prover = require('../../../app/modules/prover').duniter.methods.prover(); + const prover = require('../../../app/modules/prover').duniter.methods.prover(server); server.permaProver = prover.permaProver; server.pipe(prover); - server.startBlockComputation = () => prover.startService(server); + server.startBlockComputation = () => prover.startService(); server.stopBlockComputation = () => prover.stopService(); return server;