def __init__(self, config, _network): global wallet, network network = _network network.register_callback('updated', update_callback) network.register_callback('connected', update_callback) network.register_callback('disconnected', update_callback) network.register_callback('disconnecting', update_callback) storage = WalletStorage(config) if not storage.file_exists: action = self.restore_or_create() if not action: exit() wallet = Wallet(storage) if action == 'create': wallet.init_seed(None) self.show_seed() wallet.save_seed(None) wallet.synchronize() # generate first addresses offline elif action == 'restore': seed = self.seed_dialog() if not seed: exit() wallet.init_seed(str(seed)) wallet.save_seed(None) else: exit() wallet.start_threads(network) if action == 'restore': if not self.restore_wallet(): exit() self.password_dialog() else: wallet = Wallet(storage) wallet.start_threads(network)
# create table if needed check_create_table(conn) # init network config = SimpleConfig({"wallet_path": wallet_path}) network = Network(config) network.start(wait=True) # create watching_only wallet storage = WalletStorage(config) wallet = Wallet(storage) if not storage.file_exists: wallet.seed = "" wallet.create_watching_only_wallet(master_public_key, master_chain) wallet.synchronize = lambda: None # prevent address creation by the wallet wallet.start_threads(network) network.register_callback("updated", on_wallet_update) out_queue = Queue.Queue() thread.start_new_thread(server_thread, (conn,)) while not stopping: cur = conn.cursor() # read pending requests from table cur.execute("SELECT address, amount, confirmations FROM electrum_payments WHERE paid IS NULL;") data = cur.fetchall() # add pending requests to the wallet for item in data:
# create table if needed check_create_table(conn) # init network config = SimpleConfig({'wallet_path': wallet_path}) network = Network(config) network.start(wait=True) # create watching_only wallet storage = WalletStorage(config) wallet = Wallet(storage) if not storage.file_exists: wallet.seed = '' wallet.create_watching_only_wallet(master_public_key, master_chain) wallet.synchronize = lambda: None # prevent address creation by the wallet wallet.start_threads(network) network.register_callback('updated', on_wallet_update) out_queue = Queue.Queue() thread.start_new_thread(server_thread, (conn, )) while not stopping: cur = conn.cursor() # read pending requests from table cur.execute( "SELECT address, amount, confirmations FROM electrum_payments WHERE paid IS NULL;" ) data = cur.fetchall()