1
0

sweep/import key: show error in Qt GUI to user as tooltip

This commit is contained in:
SomberNight
2019-04-19 00:15:45 +02:00
parent 1110f13c62
commit a1d98d4331
7 changed files with 42 additions and 19 deletions

View File

@@ -752,19 +752,21 @@ def is_address_list(text):
return bool(parts) and all(bitcoin.is_address(x) for x in parts)
def get_private_keys(text, *, allow_spaces_inside_key=True):
def get_private_keys(text, *, allow_spaces_inside_key=True, raise_on_error=False):
if allow_spaces_inside_key: # see #1612
parts = text.split('\n')
parts = map(lambda x: ''.join(x.split()), parts)
parts = list(filter(bool, parts))
else:
parts = text.split()
if bool(parts) and all(bitcoin.is_private_key(x) for x in parts):
if bool(parts) and all(bitcoin.is_private_key(x, raise_on_error=raise_on_error) for x in parts):
return parts
def is_private_key_list(text, *, allow_spaces_inside_key=True):
return bool(get_private_keys(text, allow_spaces_inside_key=allow_spaces_inside_key))
def is_private_key_list(text, *, allow_spaces_inside_key=True, raise_on_error=False):
return bool(get_private_keys(text,
allow_spaces_inside_key=allow_spaces_inside_key,
raise_on_error=raise_on_error))
is_mpk = lambda x: is_old_mpk(x) or is_xpub(x)