Merge pull request #1232 from msgmaxim/fix-pow-update

Fix incorrect handling of pow update
pull/1233/head
Maxim Shishmarev 5 years ago committed by GitHub
commit 8ce1b5c343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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