diff --git a/lib/blockchain/install.js b/lib/blockchain/install.js index 717c9945..c2932383 100644 --- a/lib/blockchain/install.js +++ b/lib/blockchain/install.js @@ -112,6 +112,11 @@ function plugin (crypto) { return plugin } +function getSyncedBlockchains (cryptoList) { + const installedCryptos = _.reduce((acc, value) => ({ ...acc, [value.cryptoCode]: isInstalledSoftware(value) && isInstalledVolume(value) }), {}, cryptoList) + const syncedBlockchains = plugin() +} + function run () { const choices = _.flow([ _.filter(c => c.type !== 'erc-20'), @@ -132,10 +137,14 @@ function run () { questions.push({ type: 'checkbox', name: 'crypto', - message: 'Which cryptocurrencies would you like to install?', - choices + message: 'Which cryptocurrencies would you like to install?\nTo prevent server resource overloading, only TWO coins should be installed simultaneously.\nMore coins can be installed after this process is over.', + choices, + validate: (a) => { + getSyncedBlockchains(cryptos) + return _.size(a) > 0 && _.size(a) <= 2 + } }) inquirer.prompt(questions) - .then(answers => processCryptos(answers.crypto)) + .then(answers => console.log('answers', answers) /* processCryptos(answers.crypto) */) } diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index 51d48910..3b9a4e0a 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -176,6 +176,12 @@ function supportsBatching (cryptoCode) { .then(() => SUPPORTS_BATCHING) } +function checkBlockchainStatus (cryptoCode) { + return checkCryptoCode(cryptoCode) + .then(() => fetch('getblockchaininfo')) + .then(res => !!res['initialblockdownload'] ? 'ready' : 'syncing') +} + module.exports = { balance, sendCoins,