Merge pull request #582 from dabura667/csvaddresserr
CSV: Show erroneous addresses in warning window.
This commit is contained in:
commit
e34c14ee78
|
@ -1904,15 +1904,25 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
def do_process_from_csvReader(self, csvReader):
|
def do_process_from_csvReader(self, csvReader):
|
||||||
outputs = []
|
outputs = []
|
||||||
|
errors = []
|
||||||
|
errtext = ""
|
||||||
try:
|
try:
|
||||||
for row in csvReader:
|
for position, row in enumerate(csvReader):
|
||||||
address = row[0]
|
address = row[0]
|
||||||
|
if not is_valid(address):
|
||||||
|
errors.append((position, address))
|
||||||
|
continue
|
||||||
amount = Decimal(row[1])
|
amount = Decimal(row[1])
|
||||||
amount = int(100000000*amount)
|
amount = int(100000000*amount)
|
||||||
outputs.append((address, amount))
|
outputs.append((address, amount))
|
||||||
except (ValueError, IOError, os.error), reason:
|
except (ValueError, IOError, os.error), reason:
|
||||||
QMessageBox.critical(None, _("Unable to read file or no transaction found"), _("Electrum was unable to open your transaction file") + "\n" + str(reason))
|
QMessageBox.critical(None, _("Unable to read file or no transaction found"), _("Electrum was unable to open your transaction file") + "\n" + str(reason))
|
||||||
return
|
return
|
||||||
|
if errors != []:
|
||||||
|
for x in errors:
|
||||||
|
errtext += "CSV Row " + str(x[0]+1) + ": " + x[1] + "\n"
|
||||||
|
QMessageBox.critical(None, _("Invalid Addresses"), _("ABORTING! Invalid Addresses found:") + "\n\n" + errtext)
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tx = self.wallet.make_unsigned_transaction(outputs, None, None)
|
tx = self.wallet.make_unsigned_transaction(outputs, None, None)
|
||||||
|
|
|
@ -1262,7 +1262,7 @@ class NewWallet:
|
||||||
|
|
||||||
def make_unsigned_transaction(self, outputs, fee=None, change_addr=None, domain=None ):
|
def make_unsigned_transaction(self, outputs, fee=None, change_addr=None, domain=None ):
|
||||||
for address, x in outputs:
|
for address, x in outputs:
|
||||||
assert is_valid(address)
|
assert is_valid(address), "Address " + address + " is invalid!"
|
||||||
amount = sum( map(lambda x:x[1], outputs) )
|
amount = sum( map(lambda x:x[1], outputs) )
|
||||||
inputs, total, fee = self.choose_tx_inputs( amount, fee, domain )
|
inputs, total, fee = self.choose_tx_inputs( amount, fee, domain )
|
||||||
if not inputs:
|
if not inputs:
|
||||||
|
|
Loading…
Reference in New Issue