Fix incorrect handling of pow update

pull/1232/head
Maxim Shishmarev 5 years ago
parent d92bf6febf
commit 7724df25cc

@ -300,11 +300,15 @@ export async function storeOnNode(
const res = snodeRes as any;
const json = JSON.parse(snodeRes.body);
// Make sure we aren't doing too much PoW
const currentDifficulty = window.storage.get('PoWDifficulty', null);
if (res && res.difficulty && res.difficulty !== currentDifficulty) {
window.storage.put('PoWDifficulty', res.difficulty);
// should we return false?
if (
json &&
json.difficulty &&
json.difficulty !== parseInt(currentDifficulty, 10)
) {
window.storage.put('PoWDifficulty', json.difficulty);
}
return true;
} catch (e) {

Loading…
Cancel
Save