Browse Source

Qt Send tab: handle exc when "." is entered into amount_e

To reproduce: enter "." to amount_e in Send tab; then click "Save".

Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1638, in do_save_invoice
    self.pending_invoice = self.read_invoice()
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1625, in read_invoice
    outputs = self.read_outputs()
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1501, in read_outputs
    outputs = self.payto_e.get_outputs(self.max_button.isChecked())
  File "/home/user/wspace/electrum/electrum/gui/qt/paytoedit.py", line 235, in get_outputs
    self.outputs = [PartialTxOutput(scriptpubkey=self.payto_scriptpubkey, value=amount)]
  File "/home/user/wspace/electrum/electrum/transaction.py", line 1533, in __init__
    TxOutput.__init__(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/transaction.py", line 113, in __init__
    raise ValueError(f"bad txout value: {value!r}")
ValueError: bad txout value: None
patch-4
SomberNight 3 years ago
parent
commit
433c6762c9
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/gui/qt/paytoedit.py

4
electrum/gui/qt/paytoedit.py

@ -226,12 +226,14 @@ class PayToEdit(CompletionTextEdit, ScanQRTextEdit, Logger):
def get_destination_scriptpubkey(self) -> Optional[bytes]:
return self.payto_scriptpubkey
def get_outputs(self, is_max):
def get_outputs(self, is_max: bool) -> List[PartialTxOutput]:
if self.payto_scriptpubkey:
if is_max:
amount = '!'
else:
amount = self.amount_edit.get_amount()
if amount is None:
return []
self.outputs = [PartialTxOutput(scriptpubkey=self.payto_scriptpubkey, value=amount)]
return self.outputs[:]

Loading…
Cancel
Save