From 98b98c8ddb89edbe00ba49f7886881c4f2cbe419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Mon, 14 Feb 2022 17:33:32 +0000 Subject: [PATCH 1/2] fix: skip not installed nodes --- bin/lamassu-update-wallet-nodes | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/lamassu-update-wallet-nodes b/bin/lamassu-update-wallet-nodes index 814aae51..c648ba4b 100644 --- a/bin/lamassu-update-wallet-nodes +++ b/bin/lamassu-update-wallet-nodes @@ -22,6 +22,18 @@ function plugin (crypto) { return plugin } +function isWalletNodeInstalled (status) { + // From http://supervisord.org/subprocess.html#process-states + switch (status) { + case 'STARTING' || 'RUNNING' || 'STOPPED' || 'BACKOFF' || 'STOPPING' || 'EXITED' || 'FATAL': + return true + case 'UNKNOWN': + return false + default: + return false + } +} + function run () { _.forEach((crypto) => { if (!_.includes(crypto.cryptoCode, _.keys(PLUGINS))) return @@ -29,6 +41,7 @@ function run () { const cryptoPlugin = plugin(crypto) const status = common.es(`sudo supervisorctl status ${crypto.code} | awk '{ print $2 }'`).trim() + if (!isWalletNodeInstalled(status)) return cryptoPlugin.updateCore(common.getBinaries(crypto.cryptoCode), _.includes(status, ['RUNNING', 'STARTING'])) }, cryptos) } From 0859b3b9388d0f837a8531c33fc91b610c346287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Mon, 14 Feb 2022 17:56:51 +0000 Subject: [PATCH 2/2] fix: include starting state on install script --- lib/blockchain/install.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/blockchain/install.js b/lib/blockchain/install.js index 53b359d3..5f2cb436 100644 --- a/lib/blockchain/install.js +++ b/lib/blockchain/install.js @@ -103,8 +103,11 @@ function setupCrypto (crypto) { function updateCrypto (crypto) { if (!common.isUpdateDependent(crypto.cryptoCode)) return const cryptoPlugin = plugin(crypto) + // TODO: we need to refactor the way we retrieve this status, p.e Monero uses two + // services with specific names, so each coin should have its implementation. + // Currently, it's not a breaking change because only BTC is update dependent const status = common.es(`sudo supervisorctl status ${crypto.code} | awk '{ print $2 }'`).trim() - const isCurrentlyRunning = status === 'RUNNING' + const isCurrentlyRunning = _.includes(status, ['RUNNING', 'STARTING']) cryptoPlugin.updateCore(common.getBinaries(crypto.cryptoCode), isCurrentlyRunning) }