Save wallet DB after adding or removing payment requests#6435
Merged
SomberNight merged 1 commit intospesmilo:masterfrom Sep 1, 2020
Merged
Save wallet DB after adding or removing payment requests#6435SomberNight merged 1 commit intospesmilo:masterfrom
SomberNight merged 1 commit intospesmilo:masterfrom
Conversation
Member
|
This looks okay. I am just wondering whether this is the right place to call |
SomberNight
added a commit
that referenced
this pull request
Jul 5, 2021
Fixes: after adding a payment request, if the process was killed, the payreq might get lost. In case of using the GUI, neither the callee nor the caller called wallet.save_db(). Unclear where wallet.save_db() should be called... Now each method tries to persist their changes by default, but as an optimisation, the caller can pass write_to_disk=False e.g. when calling multiple such methods and then call wallet.save_db() itself. If we had partial writes, which would either rm the need for wallet.save_db() or at least make it cheaper, this code might get simpler... related: #6435 related: #4823
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When using the
add_requestcommand I realized that the returned address will be reused in the next payment request after I restart my electrum daemon (if no other operation which saves the walletDB has been performed in the meantime).It seems that the
add_request,add_lightning_requestandrmrequestcommands change the wallet DB (by adding or removing payment requests), but do not flush the changes down to the disk.If any other operation later on changes the wallet DB, then the changes of the 3 commands will also be flushed. If not, then the changes (payment requests) might get lost.
(
clear_requestsis not affected asself.save_db()is called inwallet.pyinclear_requests(self).)This PR:
wallet.save_db()to RPC commands which change the Wallet DB but didn't save them