commit b0c390e231cf7a2e2b6fe831af88ea368f80027c
parent abac4a4340dc1aa82989ebea4032005bee048d6f
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 26 Jun 2020 09:47:16 +0200
wallet.clear_requests. fixes #6279
Diffstat:
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/electrum/commands.py b/electrum/commands.py
@@ -877,8 +877,8 @@ class Commands:
@command('w')
async def clear_requests(self, wallet: Abstract_Wallet = None):
"""Remove all payment requests"""
- for k in list(wallet.receive_requests.keys()):
- wallet.remove_payment_request(k)
+ wallet.clear_requests()
+ return True
@command('w')
async def clear_invoices(self, wallet: Abstract_Wallet = None):
diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py
@@ -535,9 +535,7 @@ class ReceiveScreen(CScreen):
return
def callback(c):
if c:
- for req in requests:
- key = req.get('rhash') or req['address']
- self.app.wallet.delete_request(key)
+ self.app.wallet.clear_requests()
self.update()
n = len(requests)
d = Question(_('Delete {} requests?').format(n), callback)
diff --git a/electrum/wallet.py b/electrum/wallet.py
@@ -726,6 +726,10 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
self.invoices = {}
self.save_db()
+ def clear_requests(self):
+ self.receive_requests = {}
+ self.save_db()
+
def get_invoices(self):
out = list(self.invoices.values())
#out = list(filter(None, out)) filter out ln