diff --git a/app/lib/blockchain/DuniterBlockchain.ts b/app/lib/blockchain/DuniterBlockchain.ts index 86f7a71111118bba509b23a6b62051c5c9f0c8d2..70e8c2dd95d0c50f8547a1628e42931f89e72731 100644 --- a/app/lib/blockchain/DuniterBlockchain.ts +++ b/app/lib/blockchain/DuniterBlockchain.ts @@ -715,11 +715,13 @@ export function requiredBindexSizeForTail( TAIL: { issuersCount: number; issuersFrame: number }, conf: { medianTimeBlocks: number; dtDiffEval: number; forksize: number } ) { - return conf.forksize + - [ - TAIL.issuersCount, - TAIL.issuersFrame, - conf.medianTimeBlocks, - conf.dtDiffEval, - ].reduce((max, value) => Math.max(max, value), 0); + return ( + conf.forksize + + [ + TAIL.issuersCount, + TAIL.issuersFrame, + conf.medianTimeBlocks, + conf.dtDiffEval, + ].reduce((max, value) => Math.max(max, value), 0) + ); } diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts index 7964a89415b234eadb8abd63ff8e19da73e5fb1b..83f911f12bfc672302b5b89004420223d06df0b0 100644 --- a/app/lib/dal/fileDAL.ts +++ b/app/lib/dal/fileDAL.ts @@ -1309,7 +1309,7 @@ export class FileDAL implements ServerDAO { @MonitorExecutionTime() async trimIndexes(maxNumber: number) { - logger.trace('Trim indexes below block #%s', maxNumber) + logger.trace("Trim indexes below block #%s", maxNumber); if (!cliprogram.notrim) { await this.bindexDAL.trimBlocks(maxNumber); await this.iindexDAL.trimRecords(maxNumber); @@ -1323,7 +1323,7 @@ export class FileDAL implements ServerDAO { } async trimSandboxes(block: { medianTime: number }) { - logger.trace('Trim sandboxes below median time %s', block.medianTime) + logger.trace("Trim sandboxes below median time %s", block.medianTime); await this.certDAL.trimExpiredCerts(block.medianTime); await this.msDAL.trimExpiredMemberships(block.medianTime); await this.idtyDAL.trimExpiredIdentities(block.medianTime); diff --git a/app/lib/indexer.ts b/app/lib/indexer.ts index 8759a80d8ab5f8aeceea6b95082762cb2a6f5e81..3a9bdf3b9df0b25e81a1fedc97a755d0311db652 100644 --- a/app/lib/indexer.ts +++ b/app/lib/indexer.ts @@ -601,7 +601,8 @@ export class Indexer { const HEAD_1 = await head(1); // CHECK Bindex is valid - if (HEAD_1 && HEAD_1.number !== HEAD.number - 1) throw new Error('Invalid bindex: cannot found HEAD-1!'); + if (HEAD_1 && HEAD_1.number !== HEAD.number - 1) + throw new Error("Invalid bindex: cannot found HEAD-1!"); // BR_G04 await Indexer.prepareIssuersCount(HEAD, range, HEAD_1); diff --git a/app/modules/crawler/lib/sync.ts b/app/modules/crawler/lib/sync.ts index 6a5d4dded4df914fa6a0823ca7f98f6aebf01e51..d5d7bbbee5f9dbb7662bab4e1434adb46e9f21ae 100644 --- a/app/modules/crawler/lib/sync.ts +++ b/app/modules/crawler/lib/sync.ts @@ -260,8 +260,7 @@ export class Synchroniser extends stream.Duplex { ); this.watcher.end(); throw err; - } - finally { + } finally { // Make sure to enable check constraints, even if failed await this.server.dal.enableCheckConstraints(); } diff --git a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts index 48a28c8ccec0f9468ddc2ad87dfdb236b6a96943..b77c6add61b359e23f03563de08cdef8d87c6df1 100644 --- a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts +++ b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts @@ -205,7 +205,8 @@ export class GlobalIndexStream extends Duplex { const requiredBindexSize = requiredBindexSizeForTail(block, this.conf); if ( - (block.number <= this.to - requiredBindexSize - 1 || cliprogram.noSources) && + (block.number <= this.to - requiredBindexSize - 1 || + cliprogram.noSources) && !this.cautious ) { // If we require nosources option, this blockchain can't be valid so we don't make checks