-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save wallet file #316
Comments
Coffe is on the case |
I believe it's an issue with the encryptWalletToString(). You should use toJSONString() instead. See here: Line 90 in 126bede
|
I do not think that is the issue, the problem seems to be that the wallet only saves one time (on startup) I think you need a interval like this to save the wallet more often: Otherwise it will not remember anything that happens during the wallet is online and will thus reset on next startup |
It saves every 60s. First the saveWallet() function is called on startup: And as you can see here, the function then calls itself every 90s: Line 102 in 126bede
So either that loop crashes, potentially because it gets "too recursive" i.e. is several thousand function calls in eventually, or there is something else wrong. A better method would probaby be to have an interval that is started in server.js, something like: |
That is true lol, but in this recursive loop the variable walletExists is set to true after first save, then it will probably not save it again. Lines 97 to 99 in 126bede
|
Yeah that makes sense. After doing some research on sequalize, it seems like this is the general way of updating an entry: // Change everyone without a last name to "Doe"
await User.update({ lastName: "Doe" }, {
where: {
lastName: null
}
}); (https://sequelize.org/docs/v6/core-concepts/model-querying-basics/) That probably would translate to something like this in our codebase: await sequelize.transaction(async (t) => {
return models.Wallet.update(
{ encrypted_wallet: newEncryptedStr },
{ where: {} } // Empty where clause updates all records, i.e. the only wallet record we have
);
}); |
Currently the wallet file never gets saved, so XKR sent to the api is lost on reboot
The text was updated successfully, but these errors were encountered: