Browse Source

remove sign_payment_request: broken and not used

patch-4
ThomasV 2 years ago
parent
commit
6a9e8da218
  1. 9
      electrum/commands.py
  2. 21
      electrum/gui/qt/receive_tab.py
  3. 12
      electrum/wallet.py

9
electrum/commands.py

@ -970,15 +970,6 @@ class Commands:
wallet.save_db()
return tx.txid()
@command('wp')
async def signrequest(self, address, password=None, wallet: Abstract_Wallet = None):
"Sign payment request with an OpenAlias"
alias = self.config.get('alias')
if not alias:
raise Exception('No alias in your configuration')
alias_addr = wallet.contacts.resolve(alias)['address']
wallet.sign_payment_request(address, alias, alias_addr, password)
@command('w')
async def delete_request(self, address, wallet: Abstract_Wallet = None):
"""Remove a payment request"""

21
electrum/gui/qt/receive_tab.py

@ -268,26 +268,6 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger):
data = self.receive_lightning_qr.data
self.window.qr_window.qrw.setData(data)
def sign_payment_request(self, addr):
alias = self.config.get('alias')
if alias and self.wallet.contacts.alias_info:
alias_addr, alias_name, validated = self.wallet.contacts.alias_info
if alias_addr:
if self.wallet.is_mine(alias_addr):
msg = _('This payment request will be signed.') + '\n' + _('Please enter your password')
password = None
if self.wallet.has_keystore_encryption():
password = self.window.password_dialog(msg)
if not password:
return
try:
self.wallet.sign_payment_request(addr, alias, alias_addr, password)
except Exception as e:
self.show_error(repr(e))
return
else:
return
def create_invoice(self):
amount_sat = self.receive_amount_e.get_amount()
message = self.receive_message_e.text()
@ -314,7 +294,6 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger):
self.logger.exception('Error adding payment request')
self.show_error(_('Error adding payment request') + ':\n' + repr(e))
return
self.sign_payment_request(address)
assert key is not None
self.window.address_list.refresh_all()
self.request_list.update()

12
electrum/wallet.py

@ -2480,18 +2480,6 @@ class Abstract_Wallet(ABC, Logger, EventListener):
key = self.add_payment_request(req)
return key
def sign_payment_request(self, key, alias, alias_addr, password): # FIXME this is broken
raise
req = self._receive_requests.get(key)
assert not req.is_lightning()
alias_privkey = self.export_private_key(alias_addr, password)
pr = paymentrequest.make_unsigned_request(req)
paymentrequest.sign_request_with_alias(pr, alias, alias_privkey)
req.bip70 = pr.raw.hex()
req['name'] = pr.pki_data
req['sig'] = bh2u(pr.signature)
self._receive_requests[key] = req
@classmethod
def get_key_for_outgoing_invoice(cls, invoice: Invoice) -> str:
"""Return the key to use for this invoice in self.invoices."""

Loading…
Cancel
Save