Browse Source

activating best chain progress fix

all-modes
pbca26 8 years ago
parent
commit
5e01a6d1bc
  1. 12
      react/src/actions/actions/nativeSyncInfo.js
  2. 58
      react/src/components/dashboard/walletsProgress/walletsProgress.js

12
react/src/actions/actions/nativeSyncInfo.js

@ -63,7 +63,8 @@ export function getSyncInfoNativeKMD(skipDebug) {
function getSyncInfoNativeState(json, coin, skipDebug) {
if (coin === 'KMD' &&
json &&
json.error) {
json.error &&
json.error.message.indexOf('Activating best') === -1) {
return getSyncInfoNativeKMD(skipDebug);
} else {
if (json &&
@ -71,12 +72,12 @@ function getSyncInfoNativeState(json, coin, skipDebug) {
Config.cli.default) {
return {
type: SYNCING_NATIVE_MODE,
progress: Config.cli.default ? json.error : json,
progress: json.error,
}
} else {
return {
type: SYNCING_NATIVE_MODE,
progress: Config.cli.default ? json.result : json,
progress: json.result ? json.result : json,
}
}
}
@ -163,6 +164,11 @@ export function getSyncInfoNative(coin, skipDebug) {
json = JSON.parse(json);
}
if (json.error &&
json.error.message.indexOf('Activating best') === -1) {
dispatch(getDebugLog('komodo', 1));
}
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',

58
react/src/components/dashboard/walletsProgress/walletsProgress.js

@ -47,7 +47,49 @@ class WalletsProgress extends React.Component {
}
}
parseActivatingBestChainProgress() {
let _debugLogLine;
if (this.props.Settings.debugLog.indexOf('\n') > -1) {
const _debugLogMulti = this.props.Settings.debugLog.split('\n');
for (let i = 0; i < _debugLogMulti.length; i++) {
if (_debugLogMulti[i].indexOf('progress=') > -1) {
_debugLogLine = _debugLogMulti[i];
}
}
} else {
_debugLogLine = this.props.Settings.debugLog;
}
const temp = _debugLogLine.split(' ');
let currentBestChain;
let currentProgress;
for (let i = 0; i < temp.length; i++) {
if (temp[i].indexOf('height=') > -1) {
currentBestChain = temp[i].replace('height=', '');
}
if (temp[i].indexOf('progress=') > -1) {
currentProgress = Number(temp[i].replace('progress=', '')) * 1000;
}
}
return [
currentBestChain,
currentProgress
];
}
renderSyncPercentagePlaceholder() {
// activating best chain
if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.code &&
this.props.Dashboard.progress.code === -28 &&
this.props.Settings.debugLog) {
return SyncPercentageRender.call(this, this.parseActivatingBestChainProgress()[1].toFixed(2));
}
if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.blocks > 0 &&
this.props.Dashboard.progress.longestchain === 0) {
@ -120,9 +162,19 @@ class WalletsProgress extends React.Component {
}
}
return (
`: ${currentProgress}% (${ translate('INDEX.RESCAN_SM') })`
);
// activating best chain
if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.code &&
this.props.Dashboard.progress.code === -28 &&
this.props.Settings.debugLog) {
return (
`: ${this.parseActivatingBestChainProgress()[0]} (current block)`
);
} else {
return (
`: ${currentProgress}% (${ translate('INDEX.RESCAN_SM') })`
);
}
} else if (
this.props.Settings.debugLog.indexOf('LoadExternalBlockFile:') > -1 ||
this.props.Settings.debugLog.indexOf('Reindexing block file') > -1

Loading…
Cancel
Save