diff --git a/ZelBack/src/services/appsService.js b/ZelBack/src/services/appsService.js index b4fc0a7ff..cd70c9ad8 100644 --- a/ZelBack/src/services/appsService.js +++ b/ZelBack/src/services/appsService.js @@ -46,6 +46,7 @@ const myCache = new LRU(LRUoptions); let removalInProgress = false; let installationInProgress = false; +let storedTier = ''; function getAppIdentifier(appName) { // this id is used for volumes, docker names so we know it reall belongs to flux @@ -357,6 +358,9 @@ async function listAppsImages(req, res) { } async function nodeTier() { + if (storedTier) { + return storedTier; // node tier is not changing. We can use globally cached value. + } // get our collateral information to decide if app specifications are basic, super, bamf // getzlenodestatus.collateral const nodeStatus = await daemonService.getZelNodeStatus(); @@ -378,13 +382,16 @@ async function nodeTier() { // get collateralInformation.txindex vout const { value } = txInformation.data.vout[collateralInformation.txindex]; if (value === 10000) { - return 'basic'; + storedTier = 'basic'; + return storedTier; } if (value === 25000) { - return 'super'; + storedTier = 'super'; + return storedTier; } if (value === 100000) { - return 'bamf'; + storedTier = 'bamf'; + return storedTier; } throw new Error('Unrecognised Flux Node tier'); } diff --git a/ZelBack/src/services/idService.js b/ZelBack/src/services/idService.js index ab600872f..07b77fc96 100644 --- a/ZelBack/src/services/idService.js +++ b/ZelBack/src/services/idService.js @@ -55,10 +55,10 @@ async function loginPhrase(req, res) { // check docker availablility await appsService.dockerListContainers(false); // check Node Hardware Requirements are ok. - // const hwPassed = await confirmNodeTierHardware(); - // if (hwPassed === false) { - // throw new Error('Node hardware requirements not met'); - // } + const hwPassed = await confirmNodeTierHardware(); + if (hwPassed === false) { + throw new Error('Node hardware requirements not met'); + } // check DOS state (contains daemon checks) const dosState = await fluxCommunication.getDOSState(); if (dosState.status === 'error') { @@ -712,5 +712,4 @@ module.exports = { wsRespondLoginPhrase, wsRespondSignature, checkLoggedUser, - confirmNodeTierHardware, }; diff --git a/package.json b/package.json index 29fdf3d5d..6a0edd08c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flux", - "version": "2.0.2", + "version": "2.0.3", "description": "Flux, Your Gateway to a Decentralized World", "repository": { "type": "git",