From 01275a8c9b3f1bbbeb220fd2ec05fd9b90adf52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Mon, 30 Aug 2021 23:13:59 +0100 Subject: [PATCH] fix: access crypto code properly and add admin permissions for supervisor cmds --- lib/blockchain/bitcoin.js | 4 ++-- lib/blockchain/common.js | 3 +-- lib/blockchain/install.js | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/blockchain/bitcoin.js b/lib/blockchain/bitcoin.js index c8a3d8b8..b0d14514 100644 --- a/lib/blockchain/bitcoin.js +++ b/lib/blockchain/bitcoin.js @@ -18,7 +18,7 @@ function setup (dataDir) { function updateCore (coinRec) { common.logger.info('Updating Bitcoin Core. This may take a minute.') - common.es(`supervisorctl stop bitcoin`) + common.es(`sudo supervisorctl stop bitcoin`) common.es(`curl -#o /tmp/bitcoin.tar.gz ${coinRec.url}`) common.es(`tar -xzf /tmp/bitcoin.tar.gz -C /tmp/`) @@ -28,7 +28,7 @@ function updateCore (coinRec) { common.es(`rm /tmp/bitcoin.tar.gz`) common.logger.info('Starting wallet...') - common.es(`supervisorctl start bitcoin`) + common.es(`sudo supervisorctl start bitcoin`) common.logger.info('Bitcoin Core is updated!') } diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index 53cc6262..d9ea483e 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -3,7 +3,6 @@ const os = require('os') const path = require('path') const cp = require('child_process') const fs = require('fs') -const btc = require('./bitcoin') const _ = require('lodash/fp') @@ -94,7 +93,7 @@ function isInstalledSoftware (coinRec) { } function fetchAndInstall (coinRec) { - const requiresUpdate = isUpdateDependent(coinRec.code) + const requiresUpdate = isUpdateDependent(coinRec.cryptoCode) if (isInstalledSoftware(coinRec)) return const binaries = BINARIES[coinRec.cryptoCode] diff --git a/lib/blockchain/install.js b/lib/blockchain/install.js index 0acdf481..d7346ac9 100644 --- a/lib/blockchain/install.js +++ b/lib/blockchain/install.js @@ -94,9 +94,9 @@ function setupCrypto (crypto) { } function updateCrypto (crypto) { - if (!common.isUpdateDependent(crypto.code)) return + if (!common.isUpdateDependent(crypto.cryptoCode)) return const cryptoPlugin = plugin(crypto) - cryptoPlugin.updateCore(common.getBinaries(crypto)) + cryptoPlugin.updateCore(common.getBinaries(crypto.cryptoCode)) } function plugin (crypto) {