From 47eab0e6fc758d4766f5cbab9105712d9d0269fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Sun, 1 Aug 2021 22:31:28 +0100 Subject: [PATCH] fix: simplified double ternary fix: select XMR through the coins consts object --- lib/blockchain/common.js | 9 +++++---- lib/plugins/wallet/monerod/monerod.js | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index 1c91bf57..1f3c2d08 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -102,10 +102,11 @@ function writeSupervisorConfig (coinRec, cmd, walletCmd = '') { } function isInstalledSoftware (coinRec) { - return !_.isNil(coinRec.wallet) - ? fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.conf`) - && fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}-wallet.conf`) - : fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.conf`) + const nodeInstalled = fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.conf`) + const walletInstalled = _.isNil(coinRec.wallet) + ? true + : fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.wallet.conf`) + return nodeInstalled && walletInstalled } function fetchAndInstall (coinRec) { diff --git a/lib/plugins/wallet/monerod/monerod.js b/lib/plugins/wallet/monerod/monerod.js index 1a28e6e6..e29f90fd 100644 --- a/lib/plugins/wallet/monerod/monerod.js +++ b/lib/plugins/wallet/monerod/monerod.js @@ -3,14 +3,14 @@ const path = require('path') const _ = require('lodash/fp') const jsonRpc = require('../../common/json-rpc') -const { utils } = require('lamassu-coins') +const { COINS, utils } = require('lamassu-coins') const blockchainUtils = require('../../../coin-utils') const BN = require('../../../bn') const E = require('../../../error') const { logger } = require('../../../blockchain/common') -const cryptoRec = utils.getCryptoCurrency('XMR') +const cryptoRec = utils.getCryptoCurrency(COINS.XMR) const configPath = utils.configPath(cryptoRec, blockchainUtils.blockchainDir()) const walletDir = path.resolve(utils.cryptoDir(cryptoRec, blockchainUtils.blockchainDir()), 'wallets') const unitScale = cryptoRec.unitScale