Multiline Address error on do_send()
This commit is contained in:
parent
7337165d0e
commit
f3822cf06e
|
@ -941,7 +941,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
amount = self.amount_e.get_amount()
|
amount = self.amount_e.get_amount()
|
||||||
fee = self.fee_e.get_amount()
|
fee = self.fee_e.get_amount()
|
||||||
outputs = self.payto_e.get_outputs()
|
outputs = self.payto_e.get_outputs(False)
|
||||||
|
|
||||||
if not is_fee:
|
if not is_fee:
|
||||||
fee = None
|
fee = None
|
||||||
|
@ -1034,7 +1034,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
if self.payment_request:
|
if self.payment_request:
|
||||||
outputs = self.payment_request.get_outputs()
|
outputs = self.payment_request.get_outputs()
|
||||||
else:
|
else:
|
||||||
outputs = self.payto_e.get_outputs()
|
try:
|
||||||
|
outputs = self.payto_e.get_outputs()
|
||||||
|
except ValueError as e:
|
||||||
|
traceback.print_exc(file=sys.stdout)
|
||||||
|
self.show_message(str(e))
|
||||||
|
return
|
||||||
|
|
||||||
if not outputs:
|
if not outputs:
|
||||||
QMessageBox.warning(self, _('Error'), _('No outputs'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('No outputs'), _('OK'))
|
||||||
|
|
|
@ -23,6 +23,7 @@ from qrtextedit import QRTextEdit
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from electrum import bitcoin
|
from electrum import bitcoin
|
||||||
|
from electrum.i18n import _
|
||||||
|
|
||||||
RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}'
|
RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}'
|
||||||
RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
|
RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
|
||||||
|
@ -42,6 +43,7 @@ class PayToEdit(QRTextEdit):
|
||||||
self.c = None
|
self.c = None
|
||||||
self.textChanged.connect(self.check_text)
|
self.textChanged.connect(self.check_text)
|
||||||
self.outputs = []
|
self.outputs = []
|
||||||
|
self.errors = []
|
||||||
self.is_pr = False
|
self.is_pr = False
|
||||||
self.scan_f = self.win.pay_from_URI
|
self.scan_f = self.win.pay_from_URI
|
||||||
self.update_size()
|
self.update_size()
|
||||||
|
@ -94,6 +96,7 @@ class PayToEdit(QRTextEdit):
|
||||||
|
|
||||||
|
|
||||||
def check_text(self):
|
def check_text(self):
|
||||||
|
self.errors = []
|
||||||
if self.is_pr:
|
if self.is_pr:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -114,10 +117,11 @@ class PayToEdit(QRTextEdit):
|
||||||
self.unlock_amount()
|
self.unlock_amount()
|
||||||
return
|
return
|
||||||
|
|
||||||
for line in lines:
|
for i, line in enumerate(lines):
|
||||||
try:
|
try:
|
||||||
type, to_address, amount = self.parse_address_and_amount(line)
|
type, to_address, amount = self.parse_address_and_amount(line)
|
||||||
except:
|
except:
|
||||||
|
self.errors.append((i, line.strip()))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
outputs.append((type, to_address, amount))
|
outputs.append((type, to_address, amount))
|
||||||
|
@ -139,7 +143,7 @@ class PayToEdit(QRTextEdit):
|
||||||
self.unlock_amount()
|
self.unlock_amount()
|
||||||
|
|
||||||
|
|
||||||
def get_outputs(self):
|
def get_outputs(self, show_err=True):
|
||||||
if self.payto_address:
|
if self.payto_address:
|
||||||
try:
|
try:
|
||||||
amount = self.amount_edit.get_amount()
|
amount = self.amount_edit.get_amount()
|
||||||
|
@ -148,6 +152,12 @@ class PayToEdit(QRTextEdit):
|
||||||
|
|
||||||
self.outputs = [('address', self.payto_address, amount)]
|
self.outputs = [('address', self.payto_address, amount)]
|
||||||
|
|
||||||
|
if self.errors != [] and show_err:
|
||||||
|
errtext = ""
|
||||||
|
for x in self.errors:
|
||||||
|
errtext += _("Line #") + str(x[0]+1) + ": " + x[1] + "\n"
|
||||||
|
raise ValueError(_("ABORTING! Invalid Lines found:") + "\n\n" + errtext)
|
||||||
|
|
||||||
return self.outputs[:]
|
return self.outputs[:]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue