-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Due internal actions of edge wallet it can corrupt WalletName.json
sample of corrupted file
{"encryptionType":0,"iv_hex":"KmI7"}nbccfS5KIQIGo9k2iPW3Zp8pxV2Zg4XGo5sG3qHCU="}
You can look at really similar problem here nodejs/node#7978
Problem is located here https://github.com/EdgeApp/edge-core-js/blob/master/src/core/storage/repo.js#L78
We can call saveChanges before other saveChanges is occurs and now disklet comes...
It has relatively slow file write https://github.com/EdgeApp/disklet/blob/master/src/backends/node.ts#L89
So it tries to write, can't, tries to make directory and write one more time.
That's enough for fast second saveChanges call.
So first deepWriteFile made directory and tries to write
second saveChanges call calls deepWriteFile and tries to write too.