1
0

cli/rpc: 'restore' and 'create' commands are now available via RPC

This commit is contained in:
SomberNight
2018-10-10 20:29:51 +02:00
parent cd5453e477
commit 1233309ebd
6 changed files with 111 additions and 108 deletions

View File

@@ -711,16 +711,19 @@ def is_address_list(text):
return bool(parts) and all(bitcoin.is_address(x) for x in parts)
def get_private_keys(text):
parts = text.split('\n')
parts = map(lambda x: ''.join(x.split()), parts)
parts = list(filter(bool, parts))
def get_private_keys(text, *, allow_spaces_inside_key=True):
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):
return parts
def is_private_key_list(text):
return bool(get_private_keys(text))
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))
is_mpk = lambda x: is_old_mpk(x) or is_xpub(x)
@@ -746,7 +749,7 @@ def purpose48_derivation(account_id: int, xtype: str) -> str:
return "m/%d'/%d'/%d'/%d'" % (bip43_purpose, coin, account_id, script_type_int)
def from_seed(seed, passphrase, is_p2sh):
def from_seed(seed, passphrase, is_p2sh=False):
t = seed_type(seed)
if t == 'old':
keystore = Old_KeyStore({})