diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c6663..9f91a19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +#### v1.1.5 +##### 2019-12-22 + +* Fix startup issues when connecting to a node that's not ready to serve data (e.g. verifying blocks) + #### v1.1.4 ###### 2019-12-04 diff --git a/app.js b/app.js index 11772bb..519937b 100755 --- a/app.js +++ b/app.js @@ -186,17 +186,11 @@ function verifyRpcConnection() { coreApi.getBlockchainInfo().then(function(getblockchaininfo) { global.activeBlockchain = getblockchaininfo.chain; - // localservicenames introduced in 0.19 - var services = getnetworkinfo.localservicesnames ? ("[" + getnetworkinfo.localservicesnames.join(", ") + "]") : getnetworkinfo.localservices; - - debugLog(`RPC Connected: version=${getnetworkinfo.version} (${getnetworkinfo.subversion}), protocolversion=${getnetworkinfo.protocolversion}, chain=${getblockchaininfo.chain}, services=${services}`); - - // load historical/fun items for this chain - loadHistoricalDataForChain(global.activeBlockchain); - // we've verified rpc connection, no need to keep trying clearInterval(global.verifyRpcConnectionIntervalId); + onRpcConnectionVerified(getnetworkinfo, getblockchaininfo); + }).catch(function(err) { utils.logError("329u0wsdgewg6ed", err); }); @@ -206,6 +200,25 @@ function verifyRpcConnection() { } } +function onRpcConnectionVerified(getnetworkinfo, getblockchaininfo) { + // localservicenames introduced in 0.19 + var services = getnetworkinfo.localservicesnames ? ("[" + getnetworkinfo.localservicesnames.join(", ") + "]") : getnetworkinfo.localservices; + + debugLog(`RPC Connected: version=${getnetworkinfo.version} (${getnetworkinfo.subversion}), protocolversion=${getnetworkinfo.protocolversion}, chain=${getblockchaininfo.chain}, services=${services}`); + + // load historical/fun items for this chain + loadHistoricalDataForChain(global.activeBlockchain); + + if (global.activeBlockchain == "main") { + if (global.exchangeRates == null) { + utils.refreshExchangeRates(); + } + + // refresh exchange rate periodically + setInterval(utils.refreshExchangeRates, 1800000); + } +} + app.onStartup = function() { global.config = config; @@ -313,14 +326,6 @@ app.continueStartup = function() { setInterval(getSourcecodeProjectMetadata, 3600000); } - if (global.activeBlockchain == "main") { - if (global.exchangeRates == null) { - utils.refreshExchangeRates(); - } - - // refresh exchange rate periodically - setInterval(utils.refreshExchangeRates, 1800000); - } utils.logMemoryUsage(); setInterval(utils.logMemoryUsage, 5000);