|
|
@ -19,10 +19,12 @@ class WalletsProgress extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
isFullySynced() { |
|
|
|
if ((Number(this.props.Dashboard.progress.balances) + |
|
|
|
Number(this.props.Dashboard.progress.validated) + |
|
|
|
Number(this.props.Dashboard.progress.bundles) + |
|
|
|
Number(this.props.Dashboard.progress.utxo)) / 4 === 100) { |
|
|
|
const _progress = this.props.ActiveCoin.progress; |
|
|
|
|
|
|
|
if ((Number(_progress.balances) + |
|
|
|
Number(_progress.validated) + |
|
|
|
Number(_progress.bundles) + |
|
|
|
Number(_progress.utxo)) / 4 === 100) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
@ -38,9 +40,11 @@ class WalletsProgress extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
renderChainActivationNotification() { |
|
|
|
if (this.props.Dashboard.progress) { |
|
|
|
if ((!this.props.Dashboard.progress.blocks && !this.props.Dashboard.progress.longestchain) || |
|
|
|
(this.props.Dashboard.progress.blocks < this.props.Dashboard.progress.longestchain)) { |
|
|
|
const _progress = this.props.ActiveCoin.progress; |
|
|
|
|
|
|
|
if (_progress) { |
|
|
|
if ((!_progress.blocks && !_progress.longestchain) || |
|
|
|
(_progress.blocks < _progress.longestchain)) { |
|
|
|
return ChainActivationNotificationRender.call(this); |
|
|
|
} |
|
|
|
} else { |
|
|
@ -86,35 +90,37 @@ class WalletsProgress extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
renderSyncPercentagePlaceholder() { |
|
|
|
const _progress = this.props.ActiveCoin.progress; |
|
|
|
|
|
|
|
// activating best chain
|
|
|
|
if (this.props.Dashboard.progress && |
|
|
|
this.props.Dashboard.progress.code && |
|
|
|
this.props.Dashboard.progress.code === -28 && |
|
|
|
if (_progress && |
|
|
|
_progress.code && |
|
|
|
_progress.code === -28 && |
|
|
|
this.props.Settings.debugLog) { |
|
|
|
const _progress = this.parseActivatingBestChainProgress(); |
|
|
|
const _parseProgress = this.parseActivatingBestChainProgress(); |
|
|
|
|
|
|
|
if (_progress && |
|
|
|
_progress[1]) { |
|
|
|
return SyncPercentageRender.call(this, _progress[1] === 1000 ? 100 : _progress[1].toFixed(2)); |
|
|
|
if (_parseProgress && |
|
|
|
_parseProgress[1]) { |
|
|
|
return SyncPercentageRender.call(this, _parseProgress[1] === 1000 ? 100 : _parseProgress[1].toFixed(2)); |
|
|
|
} else { |
|
|
|
return LoadingBlocksRender.call(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.props.Dashboard.progress && |
|
|
|
this.props.Dashboard.progress.blocks > 0 && |
|
|
|
this.props.Dashboard.progress.longestchain === 0) { |
|
|
|
if (_progress && |
|
|
|
_progress.blocks > 0 && |
|
|
|
_progress.longestchain === 0) { |
|
|
|
return SyncErrorLongestChainRender.call(this); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.props.Dashboard.progress && |
|
|
|
this.props.Dashboard.progress.blocks === 0) { |
|
|
|
if (_progress && |
|
|
|
_progress.blocks === 0) { |
|
|
|
return SyncErrorBlocksRender.call(this); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.props.Dashboard.progress && |
|
|
|
this.props.Dashboard.progress.blocks) { |
|
|
|
const syncPercentage = (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0); |
|
|
|
if (_progress && |
|
|
|
_progress.blocks) { |
|
|
|
const syncPercentage = (parseFloat(parseInt(_progress.blocks, 10) * 100 / parseInt(_progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0); |
|
|
|
return SyncPercentageRender.call(this, syncPercentage === 1000 ? 100 : syncPercentage); |
|
|
|
} |
|
|
|
|
|
|
@ -129,8 +135,8 @@ class WalletsProgress extends React.Component { |
|
|
|
if (this.props.Settings && |
|
|
|
this.props.Settings.debugLog) { |
|
|
|
if (this.props.Settings.debugLog.indexOf('UpdateTip') > -1 && |
|
|
|
!this.props.Dashboard.progress && |
|
|
|
!this.props.Dashboard.progress.blocks) { |
|
|
|
!this.props.ActiveCoin.progress && |
|
|
|
!this.props.ActiveCoin.progress.blocks) { |
|
|
|
const temp = this.props.Settings.debugLog.split(' '); |
|
|
|
let currentBestChain; |
|
|
|
let currentProgress; |
|
|
@ -145,23 +151,23 @@ class WalletsProgress extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
// fallback to local data if remote node is inaccessible
|
|
|
|
if (this.props.Dashboard.progress.remoteKMDNode && |
|
|
|
!this.props.Dashboard.progress.remoteKMDNode.blocks) { |
|
|
|
if (this.props.ActiveCoin.progress.remoteKMDNode && |
|
|
|
!this.props.ActiveCoin.progress.remoteKMDNode.blocks) { |
|
|
|
return ( |
|
|
|
`: ${currentProgress}% (${ translate('INDEX.ACTIVATING_SM') })` |
|
|
|
); |
|
|
|
} else { |
|
|
|
if (this.props.Dashboard.progress.remoteKMDNode && |
|
|
|
this.props.Dashboard.progress.remoteKMDNode.blocks) { |
|
|
|
if (this.props.ActiveCoin.progress.remoteKMDNode && |
|
|
|
this.props.ActiveCoin.progress.remoteKMDNode.blocks) { |
|
|
|
return( |
|
|
|
`: ${Math.floor(currentBestChain * 100 / this.props.Dashboard.progress.remoteKMDNode.blocks)}% (${ translate('INDEX.BLOCKS_SM') } ${currentBestChain} / ${this.props.Dashboard.progress.remoteKMDNode.blocks})` |
|
|
|
`: ${Math.floor(currentBestChain * 100 / this.props.ActiveCoin.progress.remoteKMDNode.blocks)}% (${ translate('INDEX.BLOCKS_SM') } ${currentBestChain} / ${this.props.ActiveCoin.progress.remoteKMDNode.blocks})` |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if ( |
|
|
|
this.props.Settings.debugLog.indexOf('Still rescanning') > -1 && |
|
|
|
!this.props.Dashboard.progress || |
|
|
|
!this.props.Dashboard.progress.blocks |
|
|
|
!this.props.ActiveCoin.progress || |
|
|
|
!this.props.ActiveCoin.progress.blocks |
|
|
|
) { |
|
|
|
const temp = this.props.Settings.debugLog.split(' '); |
|
|
|
let currentProgress; |
|
|
@ -173,9 +179,9 @@ class WalletsProgress extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
// activating best chain
|
|
|
|
if (this.props.Dashboard.progress && |
|
|
|
this.props.Dashboard.progress.code && |
|
|
|
this.props.Dashboard.progress.code === -28 && |
|
|
|
if (this.props.ActiveCoin.progress && |
|
|
|
this.props.ActiveCoin.progress.code && |
|
|
|
this.props.ActiveCoin.progress.code === -28 && |
|
|
|
this.props.Settings.debugLog) { |
|
|
|
const _blocks = this.parseActivatingBestChainProgress(); |
|
|
|
|
|
|
@ -219,8 +225,8 @@ class WalletsProgress extends React.Component { |
|
|
|
if (this.props && |
|
|
|
this.props.ActiveCoin && |
|
|
|
(this.isFullMode() || this.isNativeMode())) { |
|
|
|
if (this.props.Dashboard.progress && |
|
|
|
this.props.Dashboard.progress.error) { |
|
|
|
if (this.props.ActiveCoin.progress && |
|
|
|
this.props.ActiveCoin.progress.error) { |
|
|
|
return CoinIsBusyRender.call(this); |
|
|
|
} |
|
|
|
|
|
|
@ -238,7 +244,8 @@ const mapStateToProps = (state) => { |
|
|
|
}, |
|
|
|
ActiveCoin: { |
|
|
|
mode: state.ActiveCoin.mode, |
|
|
|
coin: state.coin, |
|
|
|
coin: state.ActiveCoin.coin, |
|
|
|
progress: state.ActiveCoin.progress, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|