1
0

Improve 'send all coins' function:

* do use coin chooser when sending all coins (fixes #2000)
* allow "!" syntax for multiple outputs (fixes #1698)
This commit is contained in:
ThomasV
2016-12-31 16:29:18 +01:00
parent 662577aea6
commit e123774ea8
5 changed files with 59 additions and 53 deletions

View File

@@ -98,6 +98,8 @@ class PayToEdit(ScanQRTextEdit):
return script
def parse_amount(self, x):
if x.strip() == '!':
return '!'
p = pow(10, self.amount_edit.decimal_point())
return int(p * Decimal(x.strip()))
@@ -138,12 +140,19 @@ class PayToEdit(ScanQRTextEdit):
continue
outputs.append((_type, to_address, amount))
total += amount
if amount == '!':
self.win.is_max = True
else:
total += amount
self.outputs = outputs
self.payto_address = None
self.amount_edit.setAmount(total if outputs else None)
self.win.lock_amount(total or len(lines)>1)
if self.win.is_max:
self.win.do_update_fee()
else:
self.amount_edit.setAmount(total if outputs else None)
self.win.lock_amount(total or len(lines)>1)
def get_errors(self):
return self.errors
@@ -151,12 +160,13 @@ class PayToEdit(ScanQRTextEdit):
def get_recipient(self):
return self.payto_address
def get_outputs(self):
def get_outputs(self, is_max):
if self.payto_address:
try:
if is_max:
amount = '!'
else:
amount = self.amount_edit.get_amount()
except:
amount = None
_type, addr = self.payto_address
self.outputs = [(_type, addr, amount)]