util.check_windows_wallet_migration()
config = SimpleConfig(config_options)
- storage = WalletStorage(config)
if len(args)==0:
url = None
#sys.exit("Error: Unknown GUI: " + gui_name )
# network interface
- interface = Interface(config, True)
- interface.start(wait = False)
- interface.send([('server.peers.subscribe',[])])
-
- blockchain = BlockchainVerifier(interface, config)
- blockchain.start()
+ network = Network(config)
+ network.start()
- gui = gui.ElectrumGui(config, interface, blockchain)
+ gui = gui.ElectrumGui(config, network)
gui.main(url)
- interface.stop()
- blockchain.stop()
-
+ network.stop()
# we use daemon threads, their termination is enforced.
# this sleep command gives them time to terminate cleanly.
time.sleep(0.1)
# instanciate wallet for command-line
+ storage = WalletStorage(config)
wallet = Wallet(storage)
if cmd not in known_commands:
# open session
if cmd not in offline_commands and not options.offline:
- interface = Interface(config)
- interface.register_callback('connected', lambda: sys.stderr.write("Connected to " + interface.connection_msg + "\n"))
-
- if not interface.start(wait=True):
+ network = Network(config)
+ network.register_callback('connected', lambda: sys.stderr.write("Connected to " + network.interface.connection_msg + "\n"))
+ if not network.start(wait=True):
print_msg("Not connected, aborting.")
sys.exit(1)
- blockchain = BlockchainVerifier(interface, config)
- blockchain.start()
- wallet.start_threads(interface, blockchain)
+
+ wallet.start_threads(network)
wallet.update()
if raw_input("Are you sure you want to continue? (y/n) ") in ['y','Y','yes']:
wallet.config.path = ns
wallet.seed = ''
- wallet.config.set_key('seed', '', True)
+ wallet.storage.put('seed', '', True)
wallet.use_encryption = False
- wallet.config.set_key('use_encryption', wallet.use_encryption, True)
+ wallet.storage.put('use_encryption', wallet.use_encryption, True)
for k in wallet.imported_keys.keys(): wallet.imported_keys[k] = ''
wallet.config.set_key('imported_keys',wallet.imported_keys, True)
print_msg("Done.")
elif cmd == 'getconfig':
key = args[1]
- print_msg(wallet.config.get(key))
+ print_msg(config.get(key))
elif cmd == 'setconfig':
key, value = args[1:3]
if key not in ['seed', 'seed_version', 'master_public_key', 'use_encryption']:
- wallet.config.set_key(key, value, True)
+ config.set_key(key, value, True)
print_msg(True)
else:
print_msg(False)
if cmd not in offline_commands and not options.offline:
wallet.stop_threads()
- interface.stop()
- blockchain.stop()
+ network.stop()
time.sleep(0.1)
sys.exit(0)