From fc35f3f02f091365e8a69a15a5bfd56bc1b1ba57 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 10 Mar 2018 14:49:41 +0300 Subject: [PATCH] spv reconnect missing check --- .../dashboard/walletsData/walletsData.js | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/react/src/components/dashboard/walletsData/walletsData.js b/react/src/components/dashboard/walletsData/walletsData.js index 48c8196..e827abd 100644 --- a/react/src/components/dashboard/walletsData/walletsData.js +++ b/react/src/components/dashboard/walletsData/walletsData.js @@ -332,37 +332,39 @@ class WalletsData extends React.Component { } spvAutoReconnect() { - let _spvServers = this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].serverList; - let _server = [ - this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].server.ip, - this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].server.port - ]; - const _randomServer = getRandomElectrumServer(_spvServers, _server.join(':')); - - shepherdElectrumCheckServerConnection(_randomServer.ip, _randomServer.port) - .then((res) => { - if (res.result) { - shepherdElectrumSetServer(this.props.ActiveCoin.coin, _randomServer.ip, _randomServer.port) - .then((serverSetRes) => { + if (this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].serverList !== 'none') { + let _spvServers = this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].serverList; + let _server = [ + this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].server.ip, + this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].server.port + ]; + const _randomServer = getRandomElectrumServer(_spvServers, _server.join(':')); + + shepherdElectrumCheckServerConnection(_randomServer.ip, _randomServer.port) + .then((res) => { + if (res.result) { + shepherdElectrumSetServer(this.props.ActiveCoin.coin, _randomServer.ip, _randomServer.port) + .then((serverSetRes) => { + Store.dispatch( + triggerToaster( + `${this.props.ActiveCoin.coin} SPV ${translate('DASHBOARD.SERVER_SET_TO')} ${_randomServer.ip}:${_randomServer.port}`, + translate('TOASTR.WALLET_NOTIFICATION'), + 'success' + ) + ); + Store.dispatch(electrumServerChanged(true)); + }); + } else { Store.dispatch( triggerToaster( - `${this.props.ActiveCoin.coin} SPV ${translate('DASHBOARD.SERVER_SET_TO')} ${_randomServer.ip}:${_randomServer.port}`, + `${this.props.ActiveCoin.coin} SPV ${translate('DASHBOARD.SERVER_SM')} ${_randomServer.ip}:${_randomServer.port} ${translate('DASHBOARD.IS_UNREACHABLE')}!`, translate('TOASTR.WALLET_NOTIFICATION'), - 'success' + 'error' ) ); - Store.dispatch(electrumServerChanged(true)); - }); - } else { - Store.dispatch( - triggerToaster( - `${this.props.ActiveCoin.coin} SPV ${translate('DASHBOARD.SERVER_SM')} ${_randomServer.ip}:${_randomServer.port} ${translate('DASHBOARD.IS_UNREACHABLE')}!`, - translate('TOASTR.WALLET_NOTIFICATION'), - 'error' - ) - ); - } - }); + } + }); + } } isFullySynced() {