change the deseed command, remove reseed
This commit is contained in:
parent
4916aefe98
commit
8225028dd1
44
electrum
44
electrum
@ -83,9 +83,7 @@ options:\n --fee, -f: set transaction fee\n --fromaddr, -s: send from address
|
|||||||
'set':
|
'set':
|
||||||
"Set config parameter.",
|
"Set config parameter.",
|
||||||
'deseed':
|
'deseed':
|
||||||
"Remove seed from the wallet. The seed is stored in a file that has the name of the wallet plus '.seed'",
|
"Create a seedless, watching-only wallet.",
|
||||||
'reseed':
|
|
||||||
"Restore seed of the wallet. The wallet must have no seed, and the seed must match the wallet's master public key.",
|
|
||||||
'freeze':'',
|
'freeze':'',
|
||||||
'unfreeze':'',
|
'unfreeze':'',
|
||||||
'prioritize':'',
|
'prioritize':'',
|
||||||
@ -107,7 +105,7 @@ offline_commands = [ 'password', 'mktx',
|
|||||||
'signmessage', 'verifymessage',
|
'signmessage', 'verifymessage',
|
||||||
'eval', 'set', 'get', 'create', 'addresses',
|
'eval', 'set', 'get', 'create', 'addresses',
|
||||||
'importprivkey', 'seed',
|
'importprivkey', 'seed',
|
||||||
'deseed','reseed',
|
'deseed',
|
||||||
'freeze','unfreeze',
|
'freeze','unfreeze',
|
||||||
'prioritize','unprioritize',
|
'prioritize','unprioritize',
|
||||||
'dumpprivkey','listunspent',
|
'dumpprivkey','listunspent',
|
||||||
@ -453,15 +451,11 @@ if __name__ == '__main__':
|
|||||||
elif cmd == 'deseed':
|
elif cmd == 'deseed':
|
||||||
if not wallet.seed:
|
if not wallet.seed:
|
||||||
print_msg("Error: This wallet has no seed")
|
print_msg("Error: This wallet has no seed")
|
||||||
elif wallet.use_encryption:
|
|
||||||
print_msg("Error: This wallet is encrypted")
|
|
||||||
else:
|
else:
|
||||||
ns = wallet.config.path + '.seed'
|
ns = wallet.config.path + '.seedless'
|
||||||
print_msg("Warning: you are going to extract the seed from '%s'\nThe seed will be saved in '%s'"%(wallet.config.path,ns))
|
print_msg("Warning: you are going to create a seedless wallet'\nIt will be saved in '%s'"%ns)
|
||||||
if raw_input("Are you sure you want to continue? (y/n) ") in ['y','Y','yes']:
|
if raw_input("Are you sure you want to continue? (y/n) ") in ['y','Y','yes']:
|
||||||
f = open(ns,'w')
|
wallet.config.path = ns
|
||||||
f.write(repr({'seed':wallet.seed, 'imported_keys':wallet.imported_keys})+"\n")
|
|
||||||
f.close()
|
|
||||||
wallet.seed = ''
|
wallet.seed = ''
|
||||||
wallet.config.set_key('seed','', True)
|
wallet.config.set_key('seed','', True)
|
||||||
for k in wallet.imported_keys.keys(): wallet.imported_keys[k] = ''
|
for k in wallet.imported_keys.keys(): wallet.imported_keys[k] = ''
|
||||||
@ -470,34 +464,6 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
print_msg("Action canceled.")
|
print_msg("Action canceled.")
|
||||||
|
|
||||||
elif cmd == 'reseed':
|
|
||||||
if wallet.seed:
|
|
||||||
print_msg("Warning: This wallet already has a seed", wallet.seed)
|
|
||||||
else:
|
|
||||||
ns = wallet.config.path + '.seed'
|
|
||||||
try:
|
|
||||||
f = open(ns,'r')
|
|
||||||
data = f.read()
|
|
||||||
f.close()
|
|
||||||
except IOError:
|
|
||||||
sys.exit("Error: Seed file not found")
|
|
||||||
try:
|
|
||||||
d = ast.literal_eval( data )
|
|
||||||
seed = d['seed']
|
|
||||||
imported_keys = d.get('imported_keys',{})
|
|
||||||
except:
|
|
||||||
sys.exit("Error: Error with seed file")
|
|
||||||
|
|
||||||
mpk = wallet.get_master_public_key()
|
|
||||||
wallet.seed = seed
|
|
||||||
wallet.imported_keys = imported_keys
|
|
||||||
wallet.use_encryption = False
|
|
||||||
wallet.init_mpk(seed)
|
|
||||||
if mpk == wallet.get_master_public_key():
|
|
||||||
wallet.save()
|
|
||||||
print_msg("Done: " + wallet.config.path)
|
|
||||||
else:
|
|
||||||
print_msg("Error: Master public key does not match")
|
|
||||||
|
|
||||||
elif cmd == 'validateaddress':
|
elif cmd == 'validateaddress':
|
||||||
addr = args[1]
|
addr = args[1]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user