diff --git a/electrum/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py index 8cbbd3416..bd1a3ded9 100644 --- a/electrum/gui/qt/invoice_list.py +++ b/electrum/gui/qt/invoice_list.py @@ -194,5 +194,6 @@ class InvoiceList(MyTreeView): def delete_invoices(self, keys): for key in keys: - self.wallet.delete_invoice(key) + self.wallet.delete_invoice(key, write_to_disk=False) self.delete_item(key) + self.wallet.save_db() diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py index c4258ff89..c5b509a8c 100644 --- a/electrum/gui/qt/request_list.py +++ b/electrum/gui/qt/request_list.py @@ -192,6 +192,7 @@ class RequestList(MyTreeView): def delete_requests(self, keys): for key in keys: - self.wallet.delete_request(key) + self.wallet.delete_request(key, write_to_disk=False) self.delete_item(key) + self.wallet.save_db() self.receive_tab.do_clear() diff --git a/electrum/wallet.py b/electrum/wallet.py index 4d9de2028..d53d111cf 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -2517,7 +2517,7 @@ class Abstract_Wallet(ABC, Logger, EventListener): self.save_db() return key - def delete_request(self, key): + def delete_request(self, key, *, write_to_disk: bool = True): """ lightning or on-chain """ req = self._receive_requests.pop(key, None) if req is None: @@ -2526,16 +2526,18 @@ class Abstract_Wallet(ABC, Logger, EventListener): self._requests_addr_to_rhash.pop(addr) if req.is_lightning() and self.lnworker: self.lnworker.delete_payment_info(req.rhash) - self.save_db() + if write_to_disk: + self.save_db() - def delete_invoice(self, key): + def delete_invoice(self, key, *, write_to_disk: bool = True): """ lightning or on-chain """ inv = self._invoices.pop(key, None) if inv is None: return if inv.is_lightning() and self.lnworker: self.lnworker.delete_payment_info(inv.rhash) - self.save_db() + if write_to_disk: + self.save_db() def get_sorted_requests(self) -> List[Invoice]: """ sorted by timestamp """