feat: blockchain status checking no longer dependent on plugin status

This commit is contained in:
Sérgio Salgado 2022-02-24 20:57:12 +00:00
parent 3c33695b9d
commit f23f31e4d9
4 changed files with 23 additions and 27 deletions

View file

@ -228,6 +228,7 @@ function newFunding (account, cryptoCode, settings, operatorId) {
function checkBlockchainStatus (cryptoCode) {
return checkCryptoCode(cryptoCode)
.then(pify(web3.eth.isSyncing))
.then(res => _.isObject(res) ? 'syncing' : 'ready')
.then(() => connect(`http://localhost:${coins.utils.getCryptoCurrency(cryptoCode).defaultPort}`))
.then(() => web3.eth.syncing)
.then(res => res === false ? 'ready' : 'syncing')
}

View file

@ -202,10 +202,7 @@ function checkBlockchainStatus (cryptoCode) {
}
return jsonRpc.fetchDigest(rpcConfig, 'get_info')
.then(res => {
console.log('res XMR', res)
return !!res.synchronized ? 'ready' : 'syncing'
})
.then(res => !!res.synchronized ? 'ready' : 'syncing')
} catch (err) {
throw new Error('XMR daemon is currently not installed')
}