From 07afd42584d76bd59206b9fefdb754d11a989842 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Sun, 5 Apr 2020 19:42:37 +0200 Subject: [PATCH] [fix] BR_G27: if block version < 12, sigQty=1 --- app/lib/indexer.ts | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/app/lib/indexer.ts b/app/lib/indexer.ts index c691672f4..df184e6b7 100644 --- a/app/lib/indexer.ts +++ b/app/lib/indexer.ts @@ -867,7 +867,7 @@ export class Indexer { mindex.map((ENTRY: MindexEntry) => { ENTRY.isBeingRevoked = !!ENTRY.revoked_on; }); - +yarn // BR_G107 if (HEAD.number > 0) { await Promise.all( @@ -978,23 +978,20 @@ export class Indexer { ); // BR_G27 - await Promise.all( - mindex.map(async (ENTRY: MindexEntry) => { - if (ENTRY.type == "JOIN" || ENTRY.type == "ACTIVE") { - const existing = ( - await dal.cindexDAL.findByReceiverAndExpiredOn(ENTRY.pub, 0) - ).map((value) => value.issuer); - const pending = Underscore.filter( - cindex, - (c: CindexEntry) => c.receiver == ENTRY.pub && c.expired_on == 0 - ).map((value) => value.issuer); - const uniqIssuers = Underscore.uniq(existing.concat(pending)); + await Promise.all(mindex.map(async (ENTRY: MindexEntry) => { + if (ENTRY.type == 'JOIN' || ENTRY.type == 'ACTIVE') { + const existing = (await dal.cindexDAL.findByReceiverAndExpiredOn(ENTRY.pub, 0)).map(value => value.issuer) + const pending = Underscore.filter(cindex, (c:CindexEntry) => c.receiver == ENTRY.pub && c.expired_on == 0).map(value => value.issuer) + const uniqIssuers = Underscore.uniq(existing.concat(pending)) + if (HEAD.version >= 12) { ENTRY.enoughCerts = count(uniqIssuers) >= conf.sigQty; } else { - ENTRY.enoughCerts = true; + ENTRY.enoughCerts = count(uniqIssuers) >= 1; } - }) - ); + } else { + ENTRY.enoughCerts = true; + } + })) // BR_G28 await Promise.all( -- GitLab