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
Notes are not saved after abnormal termination #8951
Comments
Currently it would be too expensive to save the wallet file on each keystroke. We have recently merged support for partial writes, but only for non-encrypted files, see #8493 |
We could also just add a "Save" button though. |
I came up with a workaround in the Console that emulates save/load functionality.
Short-term, it works fine. Same for a save button in the GUI. Long-term though, I'm not sure if a manual save button is viable from a UX perspective over automatically saving the notes content. |
Partial writes of the wallet file would still not be sufficient as we are storing the notes as a single string. And the notes can become quite long, potentially hundreds of kilobytes. So what would be desired is partial updates of the notes itself (in addition to the wallet file). However, I don't think it's worth coming up with some complex design re how to store the text and update it cheaply, i.e. reimplementing more and more parts of a text editor. Instead, again, we could just have a "save" button.
I think a "load" button would not be useful. Whatever is displayed in the qt textedit should be the up to date string, and when the user clicks "save", we can persist it to the file (and also on graceful shutdown, as done already). |
I don't want a new button for that. Remember, we are dealing with abnormal termination here. |
Yes, I agree. Considering that Electrum already loads the note, if any, at startup, it doesn't really have any value. I just wrote it for completeness. |
It is quite normal for text editors to have a save button. It is expected. (name one text editor that does not have one :P) It is also more intuitive than a "delayed" automatic save, I think. We could even have both. |
Version: Electrum 4.5.0, from Python tarball
OS: Ubuntu 22.04 LTS, with KDE Plasma 5.24.7 and Qt 5.15.3
Description:
ElectrumWindow.clean_up
is not called when Electrum quits abnormally. For example, during Ctrl-C, system shut down or sign out. This means thatwallet.db.put('notes_text', ... )
is never called and the note is lost. The notes are not written anywhere else in the program.Code:
electrum/electrum/gui/qt/main_window.py
Lines 2506 to 2524 in 99f6dd5
Resolution:
The note should be autosaved whenever it is updated. This entails listening for when the Qt element is modified and then writing it out to the wallet file in a callback. I can help with that if necessary.
The text was updated successfully, but these errors were encountered: