From 64db2c5be01596cce9e6d6c450fa72c04fc1c338 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Sun, 15 Dec 2019 21:09:42 +0100 Subject: [PATCH] [ref] rename BLOCK_GENERATED_VERSION -> BLOCK_GENESIS_VERSION --- app/lib/common-libs/constants.ts | 3 ++- app/lib/computation/BlockchainContext.ts | 2 +- app/lib/constants.ts | 2 +- app/lib/rules/local_rules.ts | 2 +- app/service/IdentityService.ts | 2 +- test/dal/basic-dal-tests.ts | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/lib/common-libs/constants.ts b/app/lib/common-libs/constants.ts index f39c4e76f..cf5224b66 100755 --- a/app/lib/common-libs/constants.ts +++ b/app/lib/common-libs/constants.ts @@ -101,7 +101,8 @@ export const CommonConstants = { SIGNATURE }, - BLOCK_GENERATED_VERSION: 10, + // Version of genesis block + BLOCK_GENESIS_VERSION: 10, BLOCK_NEW_GENERATED_VERSION: 11, // Put it to 11 when ready LAST_VERSION_FOR_TX: 10, TRANSACTION_VERSION: 10, diff --git a/app/lib/computation/BlockchainContext.ts b/app/lib/computation/BlockchainContext.ts index 015a9047e..899b4b266 100644 --- a/app/lib/computation/BlockchainContext.ts +++ b/app/lib/computation/BlockchainContext.ts @@ -53,7 +53,7 @@ export class BlockchainContext { // But if no HEAD_1 exist, we must initialize a block with default values if (!this.vHEAD_1) { block = { - version: constants.BLOCK_GENERATED_VERSION, + version: constants.BLOCK_GENESIS_VERSION, time: Math.round(Date.now() / 1000), powMin: this.conf.powMin || 0, powZeros: 0, diff --git a/app/lib/constants.ts b/app/lib/constants.ts index ee55efaa0..8e2b5c6bf 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -99,7 +99,7 @@ module.exports = { PUBLIC_KEY: exact(PUBKEY), DOCUMENTS_VERSION: CommonConstants.DOCUMENTS_VERSION, - BLOCK_GENERATED_VERSION: CommonConstants.BLOCK_GENERATED_VERSION, + BLOCK_GENESIS_VERSION: CommonConstants.BLOCK_GENESIS_VERSION, LAST_VERSION_FOR_TX: 10, TRANSACTION_VERSION: CommonConstants.TRANSACTION_VERSION, diff --git a/app/lib/rules/local_rules.ts b/app/lib/rules/local_rules.ts index 35ed12a8a..81a536cbc 100644 --- a/app/lib/rules/local_rules.ts +++ b/app/lib/rules/local_rules.ts @@ -529,7 +529,7 @@ export const LOCAL_RULES_HELPERS = { return !current // 1. We use legacy version - ? constants.BLOCK_GENERATED_VERSION : (async () => { + ? constants.BLOCK_GENESIS_VERSION : (async () => { // 2. If we can, we go to the next version const blocksInFrame = (await dal.getBlocksBetween(current.number - current.issuersFrame + 1, current.number)) diff --git a/app/service/IdentityService.ts b/app/service/IdentityService.ts index db27bbf8a..99b1b1d53 100644 --- a/app/service/IdentityService.ts +++ b/app/service/IdentityService.ts @@ -149,7 +149,7 @@ export class IdentityService extends FIFOService { } toSave.expires_on = basedBlock.medianTime + this.conf.idtyWindow; } - await GLOBAL_RULES_FUNCTIONS.checkIdentitiesAreWritable({ identities: [idtyObj.inline()], version: (current && current.version) || constants.BLOCK_GENERATED_VERSION }, this.conf, this.dal); + await GLOBAL_RULES_FUNCTIONS.checkIdentitiesAreWritable({ identities: [idtyObj.inline()], version: (current && current.version) || constants.BLOCK_GENESIS_VERSION }, this.conf, this.dal); if (byAbsorption !== BY_ABSORPTION) { if (!(await this.dal.idtyDAL.sandbox.acceptNewSandBoxEntry({ certsCount: 0, diff --git a/test/dal/basic-dal-tests.ts b/test/dal/basic-dal-tests.ts index 6b578f7d5..369264012 100644 --- a/test/dal/basic-dal-tests.ts +++ b/test/dal/basic-dal-tests.ts @@ -34,7 +34,7 @@ var mocks = { block0: { "hash" : "00063EB6E83F8717CEF1D25B3E2EE308374A14B1", "signature" : "+78w7251vvRdhoIJ6IWHEiEOLxNrmfQf45Y5sYvPdnAdXkVpO1unMV5YA/G5Vhphyz1dICrbeKCPM5qbFsoWAQ==", - "version" : constants.BLOCK_GENERATED_VERSION, + "version" : constants.BLOCK_GENESIS_VERSION, "currency" : "meta_brouzouf", "issuer" : "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk", "parameters" : "0.1:86400:100:604800:2629800:3:3:2629800:3:11:600:20:144:0.67", -- GitLab