1
0

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
This commit is contained in:
SomberNight
2021-09-19 16:53:58 +02:00
parent be084dd44b
commit 433c6762c9

View File

@@ -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[:]