diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts index 5d5ca436742f1c2746e980bf6438781af8086a73..2cbd5d10251ee0aa6d505b3e3cb196951ed9f88f 100644 --- a/app/lib/dal/fileDAL.ts +++ b/app/lib/dal/fileDAL.ts @@ -519,9 +519,19 @@ export class FileDAL { .value() } - async findLeavers() { - const mss = await this.msDAL.getPendingOUT(); - return _.chain(mss).sortBy((ms:any) => -ms.sigDate).value(); + async findLeavers(blockMedianTime = 0) { + const pending = await this.msDAL.getPendingOUT(); + const mss = await Promise.all(pending.map(async (p:any) => { + const reduced = await this.mindexDAL.getReducedMS(p.issuer) + if (!reduced || !reduced.chainable_on || blockMedianTime >= reduced.chainable_on || blockMedianTime < constants.TIME_TO_TURN_ON_BRG_107) { + return p + } + return null + })) + return _.chain(mss) + .filter((ms:any) => ms) + .sortBy((ms:any) => -ms.sigDate) + .value(); } existsNonReplayableLink(from:string, to:string) { diff --git a/app/lib/logger.ts b/app/lib/logger.ts index b1a5a0e330a766a66e974f268f349fd7245d12b1..0fe2865b849f4ea81e889697798118c1ab5f3fd6 100644 --- a/app/lib/logger.ts +++ b/app/lib/logger.ts @@ -15,6 +15,7 @@ const moment = require('moment'); const path = require('path'); const winston = require('winston'); +const directory = require('../lib/system/directory'); /*************** * CALLBACK LOGGER @@ -147,6 +148,11 @@ logger.unmute = () => { } } +/** + * Default logging path + */ +logger.addHomeLogs(directory.INSTANCE_HOME) + /** * Convenience function to get logger directly */ diff --git a/app/modules/prover/lib/blockGenerator.ts b/app/modules/prover/lib/blockGenerator.ts index 48ab6db8e663bab72e59959b29c55b3aa045387e..0608a1b0291cf4a55bfdd239770aa9d9e374e265 100644 --- a/app/modules/prover/lib/blockGenerator.ts +++ b/app/modules/prover/lib/blockGenerator.ts @@ -151,7 +151,7 @@ export class BlockGenerator { private async findLeavers(current:DBBlock) { const leaveData: { [pub:string]: any } = {}; - const memberships = await this.dal.findLeavers(); + const memberships = await this.dal.findLeavers(current && current.medianTime); const leavers:string[] = []; memberships.forEach((ms:any) => leavers.push(ms.issuer)); for (const ms of memberships) { diff --git a/bin/duniter b/bin/duniter index 6394374389e297938dfe9cf0aa4221343cb48918..60946d8e66b60339c941fc107373764248fe9a38 100755 --- a/bin/duniter +++ b/bin/duniter @@ -2,27 +2,28 @@ "use strict"; const co = require('co'); -const duniter = require('../index'); -const stack = duniter.statics.autoStack(); +const logger = require("../app/lib/logger").NewLogger(); -return co(function*() { +// Specific errors handling +process.on('uncaughtException', (err) => { + // Dunno why this specific exception is not caught + if (err.code && err.code !== "EADDRNOTAVAIL" && err.code !== "EINVAL" && err.code !== "ENOENT") { + logger.error(err.stack || err.message || err); + process.exit(2); + } +}); - // Specific errors handling - process.on('uncaughtException', (err) => { - // Dunno why this specific exception is not caught - if (err.code !== "EADDRNOTAVAIL" && err.code !== "EINVAL" && err.code !== "ENOENT") { - duniter.statics.logger.error(err); - process.exit(2); - } - }); +return co(function*() { try { + const duniter = require('../index'); + const stack = duniter.statics.autoStack(); yield stack.executeStack(process.argv); // Everything went well, close Duniter quietly. process.exit(); } catch (e) { // If an unhandled error occured - duniter.statics.logger.error(e); + logger.error(e.stack || e.message || e); process.exit(1); } finally { // If we did not succeed to close before, force close with error. diff --git a/gui/index.html b/gui/index.html index edba13363263da16ba0dc8c4bf2a036160462b59..5c70a08456ee65ccb9ce21133b574bfbc2e53ed6 100644 --- a/gui/index.html +++ b/gui/index.html @@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Duniter 1.6.21</title> + <title>Duniter 1.6.23</title> <style> html { font-family: "Courier New", Courier, monospace; diff --git a/package.json b/package.json index e424d04d98c36efefc988c8f8620d72b643ab3f5..cd615c07f65b73d2e9ee29a9bfa44a333b340564 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "duniter", - "version": "1.6.21", + "version": "1.6.23", "engines": { "node": ">=8.2.1 <10", "npm": ">=3.10" @@ -12,7 +12,7 @@ "node-main": "./bin/duniter", "window": { "icon": "duniter.png", - "title": "v1.6.21", + "title": "v1.6.23", "width": 800, "height": 800, "min_width": 750, diff --git a/release/arch/windows/duniter.iss b/release/arch/windows/duniter.iss index ce8fae3655c16654fb1c052025486108bd5fefda..04619e1f3e9fd034e57716155249cdfd77fb86ef 100644 --- a/release/arch/windows/duniter.iss +++ b/release/arch/windows/duniter.iss @@ -15,7 +15,7 @@ #error "Unable to find MyAppExe" #endif -#define MyAppVerStr "v1.6.21" +#define MyAppVerStr "v1.6.23" [Setup] AppName={#MyAppName} diff --git a/release/extra/debian/package/DEBIAN/control b/release/extra/debian/package/DEBIAN/control index 3ed53943ce0310e824f9ed9569a5e03ed9fab943..eb524307e46232296c8f8ea5fa73f5f9b9025f10 100644 --- a/release/extra/debian/package/DEBIAN/control +++ b/release/extra/debian/package/DEBIAN/control @@ -1,5 +1,5 @@ Package: duniter -Version: 1.6.21 +Version: 1.6.23 Depends: unzip Section: misc Priority: optional