offline option for command line
This commit is contained in:
29
electrum
29
electrum
@@ -34,6 +34,7 @@ if __name__ == '__main__':
|
|||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
parser.add_option("-g", "--gui", dest="gui", default="qt", help="gui")
|
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("-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("-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("-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")
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
wallet.seed = str(seed)
|
wallet.seed = str(seed)
|
||||||
WalletSynchronizer(wallet).start()
|
|
||||||
print "recovering wallet..."
|
|
||||||
wallet.init_mpk( wallet.seed )
|
wallet.init_mpk( wallet.seed )
|
||||||
wallet.up_to_date_event.clear()
|
if not options.offline:
|
||||||
wallet.up_to_date = False
|
WalletSynchronizer(wallet).start()
|
||||||
wallet.update()
|
print "recovering wallet..."
|
||||||
if wallet.is_found():
|
wallet.up_to_date_event.clear()
|
||||||
wallet.fill_addressbook()
|
wallet.up_to_date = False
|
||||||
wallet.save()
|
wallet.update()
|
||||||
print "recovery successful"
|
if wallet.is_found():
|
||||||
else:
|
print "recovery successful"
|
||||||
print "found no history for this wallet"
|
else:
|
||||||
|
print "found no history for this wallet"
|
||||||
|
wallet.fill_addressbook()
|
||||||
|
wallet.save()
|
||||||
|
print "Wallet saved in '%s'"%options.wallet_path
|
||||||
else:
|
else:
|
||||||
wallet.new_seed(None)
|
wallet.new_seed(None)
|
||||||
wallet.init_mpk( wallet.seed )
|
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 "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 "Equivalently, your wallet seed can be stored and recovered with the following mnemonic code:"
|
||||||
print "\""+' '.join(mnemonic.mn_encode(wallet.seed))+"\""
|
print "\""+' '.join(mnemonic.mn_encode(wallet.seed))+"\""
|
||||||
|
print "Wallet saved in '%s'"%options.wallet_path
|
||||||
|
|
||||||
# check syntax
|
# check syntax
|
||||||
if cmd in ['payto', 'mktx']:
|
if cmd in ['payto', 'mktx']:
|
||||||
@@ -171,7 +175,7 @@ if __name__ == '__main__':
|
|||||||
cmd = 'help'
|
cmd = 'help'
|
||||||
|
|
||||||
# open session
|
# open session
|
||||||
if cmd not in offline_commands:
|
if cmd not in offline_commands and not options.offline:
|
||||||
WalletSynchronizer(wallet).start()
|
WalletSynchronizer(wallet).start()
|
||||||
wallet.update()
|
wallet.update()
|
||||||
wallet.save()
|
wallet.save()
|
||||||
@@ -288,7 +292,6 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
print "error: master public key does not match"
|
print "error: master public key does not match"
|
||||||
|
|
||||||
|
|
||||||
elif cmd == 'validateaddress':
|
elif cmd == 'validateaddress':
|
||||||
addr = args[1]
|
addr = args[1]
|
||||||
print wallet.is_valid(addr)
|
print wallet.is_valid(addr)
|
||||||
|
|||||||
Reference in New Issue
Block a user