|
|
@ -34,6 +34,7 @@ if __name__ == '__main__': |
|
|
|
parser = OptionParser(usage=usage) |
|
|
|
parser.add_option("-g", "--gui", dest="gui", default="qt", help="gui") |
|
|
|
parser.add_option("-w", "--wallet", dest="wallet_path", help="wallet path (default: electrum.dat)") |
|
|
|
parser.add_option("-o", "--offline", action="store_true", dest="offline", default=False, help="remain offline") |
|
|
|
parser.add_option("-a", "--all", action="store_true", dest="show_all", default=False, help="show all addresses") |
|
|
|
parser.add_option("-b", "--balance", action="store_true", dest="show_balance", default=False, help="show the balance at listed addresses") |
|
|
|
parser.add_option("-k", "--keys",action="store_true", dest="show_keys",default=False, help="show the private keys of listed addresses") |
|
|
@ -135,18 +136,20 @@ if __name__ == '__main__': |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
wallet.seed = str(seed) |
|
|
|
WalletSynchronizer(wallet).start() |
|
|
|
print "recovering wallet..." |
|
|
|
wallet.init_mpk( wallet.seed ) |
|
|
|
wallet.up_to_date_event.clear() |
|
|
|
wallet.up_to_date = False |
|
|
|
wallet.update() |
|
|
|
if wallet.is_found(): |
|
|
|
wallet.fill_addressbook() |
|
|
|
wallet.save() |
|
|
|
print "recovery successful" |
|
|
|
else: |
|
|
|
print "found no history for this wallet" |
|
|
|
if not options.offline: |
|
|
|
WalletSynchronizer(wallet).start() |
|
|
|
print "recovering wallet..." |
|
|
|
wallet.up_to_date_event.clear() |
|
|
|
wallet.up_to_date = False |
|
|
|
wallet.update() |
|
|
|
if wallet.is_found(): |
|
|
|
print "recovery successful" |
|
|
|
else: |
|
|
|
print "found no history for this wallet" |
|
|
|
wallet.fill_addressbook() |
|
|
|
wallet.save() |
|
|
|
print "Wallet saved in '%s'"%options.wallet_path |
|
|
|
else: |
|
|
|
wallet.new_seed(None) |
|
|
|
wallet.init_mpk( wallet.seed ) |
|
|
@ -156,6 +159,7 @@ if __name__ == '__main__': |
|
|
|
print "Please keep it in a safe place; if you lose it, you will not be able to restore your wallet." |
|
|
|
print "Equivalently, your wallet seed can be stored and recovered with the following mnemonic code:" |
|
|
|
print "\""+' '.join(mnemonic.mn_encode(wallet.seed))+"\"" |
|
|
|
print "Wallet saved in '%s'"%options.wallet_path |
|
|
|
|
|
|
|
# check syntax |
|
|
|
if cmd in ['payto', 'mktx']: |
|
|
@ -171,7 +175,7 @@ if __name__ == '__main__': |
|
|
|
cmd = 'help' |
|
|
|
|
|
|
|
# open session |
|
|
|
if cmd not in offline_commands: |
|
|
|
if cmd not in offline_commands and not options.offline: |
|
|
|
WalletSynchronizer(wallet).start() |
|
|
|
wallet.update() |
|
|
|
wallet.save() |
|
|
@ -288,7 +292,6 @@ if __name__ == '__main__': |
|
|
|
else: |
|
|
|
print "error: master public key does not match" |
|
|
|
|
|
|
|
|
|
|
|
elif cmd == 'validateaddress': |
|
|
|
addr = args[1] |
|
|
|
print wallet.is_valid(addr) |
|
|
|