|
|
@ -18,6 +18,8 @@ export function nativeGetinfoFailureState() { |
|
|
|
|
|
|
|
// TODO: use debug.log instead
|
|
|
|
export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { |
|
|
|
let _json = json; |
|
|
|
|
|
|
|
if (skipRemote) { |
|
|
|
return dispatch => { |
|
|
|
dispatch(getSyncInfoNativeState(Config.iguanaLessMode ? json.info : json )); |
|
|
@ -44,11 +46,15 @@ export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { |
|
|
|
) |
|
|
|
);*/ |
|
|
|
console.warn('remote kmd node fetch failed', true); |
|
|
|
dispatch(getSyncInfoNativeState({ remoteKMDNode: null })); |
|
|
|
_json = _json.error; |
|
|
|
_json['remoteKMDNode'] = null; |
|
|
|
dispatch(getSyncInfoNativeState(_json)); |
|
|
|
}) |
|
|
|
.then(response => response.json()) |
|
|
|
.then(json => { |
|
|
|
dispatch(getSyncInfoNativeState({ remoteKMDNode: Config.iguanaLessMode ? json.info : json })); |
|
|
|
_json = _json.error; |
|
|
|
_json['remoteKMDNode'] = json.info; |
|
|
|
dispatch(getSyncInfoNativeState(_json)); |
|
|
|
}) |
|
|
|
.then(function() { |
|
|
|
if (!skipDebug) { |
|
|
@ -60,10 +66,20 @@ export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { |
|
|
|
} |
|
|
|
|
|
|
|
function getSyncInfoNativeState(json, coin, skipDebug, skipRemote) { |
|
|
|
/*if (!json.remoteKMDNode) { |
|
|
|
json = { error: { code: -28, message: 'Activating best chain...' } }; |
|
|
|
}*/ |
|
|
|
|
|
|
|
if (json.remoteKMDNode) { |
|
|
|
return { |
|
|
|
type: SYNCING_NATIVE_MODE, |
|
|
|
progress: json, |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (coin === 'KMD' && |
|
|
|
json && |
|
|
|
json.error && |
|
|
|
json.error.message.indexOf('Activating best') === -1) { |
|
|
|
json.error.message.indexOf('Activating best') > -1) { |
|
|
|
return getSyncInfoNativeKMD(skipDebug, json, skipRemote); |
|
|
|
} else { |
|
|
|
if (json && |
|
|
@ -81,6 +97,7 @@ function getSyncInfoNativeState(json, coin, skipDebug, skipRemote) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) { |
|
|
|
let payload = { |
|
|
|